Open akospaska opened 1 month ago
Same Same but different issue here.
Situation: We already have our webhooks working via the old hook in the shopify.server.ts . The only problem is that we really want to avoid reinstalling the app in the live environment. The webhooks the way they are registered in the old way are only register with a new reinstall as far as I know.
Problem
The way to register webhooks in the toml would help our scenario. But with the following files, the webhooks wont register on deploy
or with shopify app dev --reset
.
The only webhook registering is app/uninstalled and this only sometimes if I also reinstall the Application.
I also played around with /test-endpoint or /webhooks in the shopify.app.toml and in the shopify.web.toml.
This is our shopify.app.toml:
...
[access_scopes]
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
scopes = "read_cart_transforms,read_checkout_branding_settings,read_discounts,read_payment_customizations,write_cart_transforms,write_checkout_branding_settings,write_discounts,write_payment_customizations,write_products"
[webhooks]
api_version = "2024-07"
[[webhooks.subscriptions]]
topics = [ "app/uninstalled" ]
uri = "/webhooks"
[[webhooks.subscriptions]]
topics = [ "discounts/create" ]
uri = "/test-endpoint"
[[webhooks.subscriptions]]
topics = [ "discounts/update" ]
uri = "/test-endpoint"
[[webhooks.subscriptions]]
topics = [ "discounts/delete" ]
uri = "/test-endpoint"
...
This is our web.app.toml (I dont know why it should be like this, or if i forget something)
name = "remix"
roles = ["frontend", "backend"]
webhooks_path = "/webhooks/app/uninstalled"
[commands]
dev = "npx prisma generate && npx prisma migrate deploy && npm exec remix vite:dev"
predev = "npx prisma generate"
This is our package.json (maybe important because of versions)
...
"type": "module",
"engines": {
"node": "^18.20 || ^20.10 || >=21.0.0"
},
"dependencies": {
"@prisma/client": "^5.8.0",
"@remix-run/dev": "^2.7.1",
"@remix-run/node": "^2.7.1",
"@remix-run/react": "^2.7.1",
"@remix-run/serve": "^2.7.1",
"@shopify/app-bridge-react": "^4.1.2",
"@shopify/cli": "^3.63.1",
"@shopify/polaris": "^12.0.0",
"@shopify/shopify-app-remix": "^3.3.2",
"@shopify/shopify-app-session-storage-prisma": "^5.0.2",
"isbot": "^5.1.0",
"prisma": "^5.8.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"vite-tsconfig-paths": "^5.0.1"
},
"devDependencies": {
"@remix-run/eslint-config": "^2.7.1",
"@shopify/api-codegen-preset": "^1.1.1",
"@types/eslint": "^8.40.0",
"@types/node": "^22.2.0",
"@types/react": "^18.2.31",
"@types/react-dom": "^18.2.14",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.2.4",
"typescript": "^5.2.2",
"vite": "^5.1.3"
},
"workspaces": [
"extensions/*"
],
"trustedDependencies": [
"@shopify/plugin-cloudflare"
],
"resolutions": {
"string-width": "4.2.3"
},
...
Hi! Sorry for the late response.
This answer may help: https://community.shopify.dev/t/app-uninstalled-webhook-inconsistently-subscribed-fired/685?u=zzooeeyy
Please confirm that you have:
In which of these areas are you experiencing a problem?
App
Expected behavior
App/uninstalled webhook fires.
Actual behavior
App/uninstalled webhook doesn't fire.
Verbose output
Hello Guys,
We are using declarative webhooks to register webhook endpoints. This is a great feature which saves us a lots of time and we don't have to bother the webshop's webhooks management.
However We have experienced the app/uninstalled webhook not triggers, only just sometimes.
Here is the toml file what we are using.
All of the other webhooks have fired as expected.
I have also get the registered webhooks via API but it returns an empty array. https://.myshopify.com/admin/api/2024-10/webhooks.json
So I assume the declarative webhooks are different things as the normal webhook registrations.
I have dig deep into the Shopify CLI source code but I couldn't find where the issue can be.
I have checked the ngrok logs and I see all of the webhooks endpoint have been called, only the app/uninstalled is missing.
We have an another application which runs in production 2.5 years long, and we manage the shop's webhooks registration with API calls and it works fine.
I have seen not the same but sort of part of the issue here allready: https://github.com/Shopify/shopify-app-template-remix/issues/818
There are couple of suggestions to 'shopify app deploy -- --reset' and so on. My problem is we are almost ready and want to be launched the application. I don't see how can or should I call the shopify app deploy by every uninstall, however the shopify app deploy -- --reset doesn't solve my issue locally.
Thank you guys all of your help in advance!
Ákos
Reproduction steps
Operating System
ubuntu
Shopify CLI version (check your project's
package.json
if you're not sure)3.64.1
Shell
No response
Node version (run
node -v
if you're not sure)v20.9.0
What language and version are you using in your application?
Express+ react