I’m working on an app locally and I had a webhook subscribed to order/create, it uses http as the delivery method via a remix route, and is configured via the shopify.app.toml. It was receiving hits whenever I ran through the testing checkout. This seems to have stopped and I can’t work out why.
If I go and check my app “versions” I can see two webhooks registered
When I go into “insights > webhook metrics” I can’t see orders/create maybe because it’s not fired in the last 7 days? There are also no removed webhooks listed.
I can trigger the action locally from the CLI, which makes me think shopify has unsubscribed me for some reason?
things tried
based on posts here and elsewhere I tried the following
deploy a fresh version of the app via the CLI
uninstall and reinstall the app from my development store
npm run dev -- --reset which seems to change the formatting of my shopify.app.toml. It also updates my urls, but so does running without the --reset flag.
Run your dev command in one terminal and your deploy command in a second terminal. As you mentioned each time you run the dev command it will regenerate a new URL. You need to make sure the dev URL is still active when running your deployed version.
If you’ve changed permissions/scopes since installing your app in your dev window hit p to preview the app, if the permissions have changed it will prompt you to allow those new permissions for the app on your shop.
Thanks for you advice @Dave-Shopify, unfortunately this didn’t seem to work. My other thought was that perhaps there’s a permissions issue?
I believe I need access to protected customer data because the order will include names, contact details, etc (even thought I don’t use those in the app)
Solution for anyone else who has a similar experience.
TLDR
user error caused the webhook to be removed.
Fix
remove broken wehbook from shopify.app.toml
npm run deploy to clear webhook from shopify
reinstate webhook to config and redeploy
Description
I set up the webhook and deployed to register it as per the shopify docs, I create a PR and went back to working on a different feature. What I forgot is that shopify doesn’t know about my git usage. Although no webhook was registered in my config on a different branch shopify was using the most recent deployed version so continued to send webhooks to a dev environment with no endpoint to receive it. This resulted in the webhook being removed. When I looked into the issue 7 days had elapsed so the “removed webhook” section of the metrics was sitting at 0.
The actual issue is a “bug” (or lack of feature depending on how you look at it) in the CLI, webhook URLs are registered on deploy. If you have dynamic URLs via cloudflare tunnel or similar the webhook breaks as soon as you npm run dev
That explains why @dave-shopify suggested to run the dev server then deploy.