2021年3月8日星期一

Webhooks in shopify/shopify-api using nodejs

I was testing the node shopify-api and I noticed that there was a code in server.js that registers the APP_UNINSTALLED webhook. so, I added the code below to try to receive the FULFILLMENTS_UPDATE webhook but I am getting an error. I am not sure but I am thinking that this might be a bug.

Is it possible to register other webhooks using 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)        
https://stackoverflow.com/questions/66539378/webhooks-in-shopify-shopify-api-using-nodejs March 09, 2021 at 09:06AM

没有评论:

发表评论