erik / hotpot

A spicy little heatmap renderer and tile server.
GNU General Public License v3.0
11 stars 1 forks source link

Strava webhook subscription does not return 200 #2

Closed TylerHext closed 5 months ago

TylerHext commented 5 months ago

Hi,

First thanks for building this, it's a really cool application that I'm having a ton of fun with.

I'm currently having difficulty setting up the webhook subscription with Strava. Below are the steps I'm taking:

  1. Run hotpot strava-auth which starts a server
  2. Navigate to 127.0.0.21:8080/strava/auth in browser
  3. Click the Authorize button, then presented with a Success screen and a couple curl commands.
  4. Kill the strava-auth server
  5. Build the docker image. I'm using the Dockerfile from this repo and I added the three environment variables. My docker run command is: docker run -d \ --mount source=hotpot-db,target=/data \ -p 0.0.0.0:8080:8080 \ hotpot-test
  6. With the tile server running and accessible via nginx proxy manager, I now run the curl command from the strava-auth success screen: curl https://www.strava.com/api/v3/push_subscriptions \ -F "client_id=secret" \ -F "client_secret=secret" \ -F "callback_url=url-of-machine-running-tileserver/strava/webhook" \ -F "verify_token=secret" The response is: { "message": "Bad Request", "errors": [ { "resource": "PushSubscription", "field": "callback url", "code": "GET to callback URL does not return 200" } ] }

I'm confused because I had the webhooks working a couple months ago using ngrok. I took the container down, pulled the most recent repo, and set up DuckDNS and Nginx Proxy Manager instead of using ngrok to port forward for webhook subscription. I'm suspicious that I messed something up by doing that, because it worked fine with ngrok for many weeks before I replaced with Nginx.

Does any of the above jump out as an issue to you? The container logs don't show the webhook subscription curl attempting to reach the callback_url so I'm not sure what non-200 code it is returning. Apologies if this is more of a networking question but I'm at a bit of a loss here.

erik commented 5 months ago

Hmm, the steps you mentioned all sound correct to me, so nothing immediately jumps out. Have you confirmed that https://url-of-machine-running-tileserver/strava/webhook is publicly accessible? The only indication the error gives is that Strava for whatever reason can't connect to your machine.

I've never used DuckDNS, but I found some Discourse posts for HomeAssistant where people mention that it does seem to work with Strava webhooks

TylerHext commented 5 months ago

Thanks for confirming it should be working. When I navigate to https://url-of-machine-running-tileserver/strava/webhook on the local network or from an outside network I receive an error page with Failed to deserialize query string: missing field 'hub.mode'. So it does sound like it's a DuckDNS issue as that's all I've changed from my working version.

I'll try a workaround of polling Strava for activities once per day and importing them to the sqlite db. If I'm able to figure out the POST endpoint I'd be happy to fill out that piece of the docs.

Thanks!