【发布时间】:2021-03-09 01:06:27
【问题描述】:
我正在测试节点 shopify-api,我注意到 server.js 中有一段代码注册了 APP_UNINSTALLED webhook。所以,我添加了下面的代码来尝试接收 FULFILLMENTS_UPDATE webhook,但我收到了一个错误。我不确定,但我认为这可能是一个错误。
是否可以使用Shopify.Webhooks.Registry.register注册其他webhook?
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)
【问题讨论】:
-
我在此页面shopify.dev/docs/admin-api/graphql/reference/events/… 上检查了 WebhookSubscriptionTopic FULFILLMENTS_UPDATE 存在,但我无法注册。
-
community.shopify.com/c/Shopify-APIs-SDKs/…我在shopify社区问过同样的问题。
标签: node.js shopify webhooks shopify-app shopify-api