I'm building a custom shopify app, where I register a webhook for SUBSCRIPTION_CONTRACTS_CREATE and SUBSCRIPTION_CONTRACTS_UPDATE topic.
Expected behavior
I expect the webhook to be registered successfully, like when I register PRODUCTS_CREATEtopic.
Actual behavior
The webhook isn't registered, and I get this traceback:
(node:53083) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'webhookSubscriptions' of null
at Object.<anonymous> (/Users/sophie/Projects/shopify-app/node_modules/@shopify/shopify-api/dist/webhooks/registry.js:92:44)
at step (/Users/sophie/Projects/shopify-app/node_modules/@shopify/shopify-api/node_modules/tslib/tslib.js:143:27)
at Object.next (/Users/sophie/Projects/shopify-app/node_modules/@shopify/shopify-api/node_modules/tslib/tslib.js:124:57)
at fulfilled (/Users/sophie/Projects/shopify-app/node_modules/@shopify/shopify-api/node_modules/tslib/tslib.js:114:62)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Steps to reproduce the problem
use koa-shopify-auth version 4.1.2
Add this code to your custom/public shopify app afterAuth:
Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: '/webhooks',
topic: 'SUBSCRIPTION_CONTRACTS_CREATE',
apiVersion: ApiVersion.April21, // I also tried '2021-07' and ApiVersion.January21
webhookHandler: (_topic, shop, _body) => { console.log('Subscription Contract was created!'); }
});
Issue summary
I'm building a custom shopify app, where I register a webhook for
SUBSCRIPTION_CONTRACTS_CREATE
andSUBSCRIPTION_CONTRACTS_UPDATE
topic.Expected behavior
I expect the webhook to be registered successfully, like when I register
PRODUCTS_CREATE
topic.Actual behavior
The webhook isn't registered, and I get this traceback:
Steps to reproduce the problem
afterAuth
: