Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Context: I want to register webhooks with the offline token on heroku platform with node.js (via @Shopify/shopify-api). After installing the app into the shop i retrieve the offline access token and store it into a DB. Registering webhooks on plain old linux system - no problem. Registering webhooks with online access token - no problem on heroku.
Problem: Same code with offline access token on heroku (free web dyno) - not working. Call to shopify responds with an error.
ERROR: cannot register to webhook: Error: Failed to make Shopify HTTP request: FetchError: invalid json response body at https://shop.myshopify.com/admin/api/%272021-01%27/webhooks.json reason: Unexpected end of JSON input"}
Do you have any hints? Or experienced the same problem?
Solved! Go to the solution
This is an accepted solution.
After checking Shopify's implementation of review-app on GitHub I changed the handling of online and offline tokens accordingly. After having errors on heroku again, I removed the import of 'koa-body' and everything is working fine now.
This is an accepted solution.
After checking Shopify's implementation of review-app on GitHub I changed the handling of online and offline tokens accordingly. After having errors on heroku again, I removed the import of 'koa-body' and everything is working fine now.