05-13-2019 12:41
05-13-2019 12:41
Hello everybody,
I am trying to implement the Fitbit Web API for a client of mine. I want to implement the Subscription system, where Fitbit will ping my server when a user adds new activities.
I'm experiencing a strange issue... I've done everything required, I added the Subscription endpoint( it's active), but when I'm trying to Add a subscription after the user adds his account (all the steps are correct, as I previously used the same code for another project a few months ago) the request is timing out. I am getting a 504 Gateway Time-Out after a long while.
I would like to mention, that without the login of the user, the error (that I am not logged in) displays OK, without any timing out.
Any ideas why this might happen? Is the service down?
Thanks for your help!
05-13-2019 16:25
05-13-2019 16:25
Hi @Cosmin123
I'm a little confused by the behavior that you observed. I understand you get a 504 Gateway Timeout error when trying to add a subscription. What do you mean by "without the login of the user, the error displays OK"?
Have you successfully been able to verify your subscriber?
Gordon
05-14-2019 02:15
05-14-2019 02:15
Hi Gordon,
Sorry for the confusion. By logging in I mean setting the access token and the token type for the user (so the request is authorized).
So, if I send the access token for the user, it times out (with a very long period of 'loading'). If I don't send it (so the request is unauthorized), it displays an error instantly.
And yes, the subscriber has been verified successfully. Any ideas why this might happen?
Thank you for your help!
Best regards,
Cosmin
05-14-2019 08:41
05-14-2019 08:41
Hi @Cosmin123
Would you please private message me your client ID and I'll take a look in our logs to see what might be occurring.
Thanks!
Gordon
05-14-2019 16:47
05-14-2019 16:47
Hi @Cosmin123
Thank you for sending over your client ID. Our logs do show 504 errors for other applications, but not yours. I am seeing your application creating the subscription twice. The 201 returned from the first Add Subscription endpoint means the subscription was created. Therefore, the second add subscription command is not necessary and should be removed.
Also, I've tried reproducing this problem based on the information in our logs and everything works as expected.
Would you double-check your code to see if you have another action occurring within the client immediately after adding the subscription? Maybe adding the subscription twice is a clue to where it could be located. It's possible this other action is causing the 504 error.
Gordon
05-14-2019 23:12
05-14-2019 23:12
Hi Gordon,
I am not doing 2 requests in my code. I triple checked everything.
As soon as I access the subscription from my code, I get that error. This is the only thing I do on my end:
where 444 is my subscription id. After this, I'm exiting the script to check the $response variable, but nothing gets returned.
What's weird is that the subscription gets created in the process, but, like I said, I am not getting a response from your servers (at least that's how it looks on my end).
05-15-2019 15:23
05-15-2019 15:23
Hmm...What language are you writing your code? Is there a sample program I can test?
Gordon
05-16-2019 05:59
05-16-2019 05:59
Hi Gordon,
Of course. I sent you in a message the credentials.
Thank you!