Я тестировал узел shopify-api и заметил, что в server.js есть код, который регистрирует веб-перехватчик APP_UNINSTALLED. поэтому я добавил приведенный ниже код, чтобы попытаться получить веб-перехватчик FULFILLMENTS_UPDATE, но получаю сообщение об ошибке. Я не уверен, но думаю, что это может быть ошибка.
Можно ли зарегистрировать другие веб-перехватчики с помощью Shopify.Webhooks.Registry.register
?
const response3 = await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: "/webhooks",
topic: "FULFILLMENTS_UPDATE",
webhookHandler: async (topic, shop, body) =>{
console.log("FULFILLMENT_UPDATE webhooks", body);
// delete ACTIVE_SHOPIFY_SHOPS[shop]
},
});
if (!response3.success) {
console.log(
`Failed to register APP_UNINSTALLED webhook: ${response.result}`
);
}
┃ InternalServerError: Cannot read property 'webhookSubscriptions' of undefined
┃ at Object.throw (/home/user/src/user_test_app/node_modules/koa/lib/context.js:97:11)
┃ at /home/user/src/user_test_app/node_modules/@shopify/koa-shopify-auth/dist/src/auth/index.js:100:42
┃ at step (/home/user/src/user_test_app/node_modules/tslib/tslib.js:133:27)
┃ at Object.throw (/home/user/src/user_test_app/node_modules/tslib/tslib.js:114:57)
┃ at rejected (/home/user/src/user_test_app/node_modules/tslib/tslib.js:105:69)
┃ at processTicksAndRejections (node:internal/process/task_queues:93:5)