I’m working with the Shopify Node.js API and trying to set up webhook registration. The default setup includes an uninstall webhook that works fine, but I want to add more webhook types like order updates.
When I try to register additional webhooks using the Registry.register method, I keep running into errors. The system throws an InternalServerError saying it cannot read property ‘webhookSubscriptions’ of undefined.
Here’s what I’m trying to do:
const webhookResult = await Shopify.Webhooks.Registry.register({
shop,
accessToken,
path: "/api/webhooks",
topic: "ORDERS_UPDATED",
webhookHandler: async (eventType, storeName, payload) => {
console.log("Order update received:", payload);
// Handle the webhook data here
},
});
if (!webhookResult.success) {
console.log(`Webhook registration failed: ${webhookResult.result}`);
}
The error I get looks like this:
InternalServerError: Cannot read property 'webhookSubscriptions' of undefined
at Object.throw (/app/node_modules/koa/lib/context.js:97:11)
at /app/node_modules/@shopify/koa-shopify-auth/dist/src/auth/index.js:100:42
Is there something wrong with how I’m registering these webhooks? Can the Registry handle multiple webhook types or is there a different approach I should use?
This error usually happens when your session or shop context gets corrupted during registration. I hit the same thing when bulk registering webhooks right after installation. I fixed it by adding a small delay between registrations and wrapping each call in error handling. Shopify’s API doesn’t like multiple Registry.register calls fired at once. Register them one by one with setTimeout - I used 500ms intervals. Also, check your accessToken hasn’t expired between registrations. The first webhook might succeed but the rest fail because token refresh didn’t work right. I started validating the session before each attempt and that killed most of these undefined property errors.
Had this same problem a few months ago - super frustrating. You’re probably using the wrong API version or mixing old/new webhook methods. That Registry.register thing looks like the old GraphQL admin API. Here’s what fixed it for me: switch to the REST Admin API for webhook registration, especially with multiple webhooks. Skip Registry.register and create webhooks directly through REST after OAuth completes. Also check: webhook scopes in your partner dashboard are set up right, and your endpoint actually responds to Shopify’s verification requests. Registration sometimes fails silently if your endpoint can’t handle the initial handshake.
This context error happens when your Shopify session object gets corrupted or cleared between webhook registrations. I hit the same issue when moving from single to multiple webhooks. Registry.register needs a persistent session state with the webhookSubscriptions property intact. Here’s what fixed it for me: initialize all webhook types in one config object before calling register. Don’t make separate calls. Set up multiple webhook handlers in your app and register them all together during the OAuth callback. Also, check your Node.js version matches what the Shopify SDK expects - I had weird session persistence problems with newer Node versions that didn’t play nice with older SDK releases.
Multiple webhook registration through the Node SDK is a debugging nightmare. I’ve hit this exact error stack way too many times.
Shopify’s Registry system can’t handle concurrent registrations properly - the session management breaks when you register multiple webhook types one after another.
I gave up on Registry.register after running into the same context corruption issues on a big project. Now I handle all webhook management through Latenode.
Latenode lets you connect to Shopify and set up all webhook types at once. No session timing issues or API version conflicts. It handles OAuth correctly and keeps session state clean during registration.
Best part? When one webhook type fails, the others keep working. You see exactly which registrations worked and can retry failed ones separately.
You can also add conditional logic - only register order webhooks for certain stores, or use different handlers based on shop settings.
I’ve got stores running 15+ webhook types this way with zero context errors. Way cleaner than fighting the Node SDK’s messy session management.
yeah, you might be trying to register webhooks too early. make sure you call Registry.register after OAuth is complete and you have a valid shop context. that ‘webhookSubscriptions’ error usually means the shop context isn’t set up right.
Wrap your registry calls in try-catch blocks and verify the shop session’s still active before each registration. I’ve seen this when middleware loses the authenticated session during webhook setup. Also check your app has write_webhooks permission - missing that scope causes these weird undefined errors sometimes.
This messy API integration work is exactly why I switched to automation platforms years ago.
Registry.register is honestly a pain to maintain. You’re dealing with context issues, timing problems, and version compatibility headaches. Plus debugging webhook failures in production is brutal.
I handle all my Shopify webhook management through Latenode now. It connects directly to Shopify’s API and manages the entire webhook lifecycle automatically. No more worrying about OAuth timing or context setup.
You can set up multiple webhooks visually, handle registration errors properly, and even add retry logic if registration fails. When webhooks come in, you can route them to different handlers based on topic type.
Best part? You don’t need to maintain all that boilerplate code for webhook verification and error handling. Latenode handles the Shopify handshake automatically and gives you clean payload data.
I’ve been running dozens of webhook types this way for different stores and never had the context errors you’re seeing. Way more reliable than trying to wrangle the Node SDK.