Q: Authenticating my wearable succeeds, but takes a really long time

GoodReptile1 month ago

Hey there, we are using the Terra widget for our webapp and began connecting a fitbit device; generating the widget url and submitting all the details succeeded very quickly, however after allowing Terra to connect to the Fitbit account, there was a massive delay before redirecting back to our website. A few times the widget returned a 504 Gateway timeout error.

We tested different auth_success_redirect_url values and even removed the redirect entirely, but the long delays still persisted. How would we diagnose this issue?

terra

Alexadmin1 month ago

Hey there. This sounds like your configured webhook is taking too long to respond and Terra sends an auth_success payload synchonously when connecting devices.

To be certain that this is the cause, you can try deactivating your webhook by going on Dashboard > Connections and pressing the toggle next to Webhook.

Also, you can check the Response Times recorded from your webhook by navigating to Dashboard > Tools > Debug > Event Log and identifying an event with the Data Type set to auth_success and pressing the arrow on the right; if the response time exceeds 2000ms, you should investigate sources of delay in your webhook implementation.


GoodReptile1 month ago

I tried again with the webhook removed and the delay was gone. I believe the issue was caused by a long-running database query, we have made this async and it resolved everything. Thank you for the support.