-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
registerWebhooks()
is taking too long to run
#734
Comments
registerWebhooks()
tooks too long to runregisterWebhooks()
is taking too long to run
Question: Are you doing this manual registration still in the |
Hi @lizkenyon. My custom registration is still in the export const shopifyConfig = shopifyApp({
...
webhooks: undefined,
hooks: {
async afterAuth({ session, admin }) {
console.time("customRegister");
await Promise.all(topics.map(topic => registerWebhook(topic, session)));
console.timeEnd("customRegister"); // ~300ms
}
},
});
async function registerWebhook(
topic: WebhookSubscriptionTopic,
{ shop: shopifyDomain, accessToken}: Session
) {
if(accessToken == null) {
return;
}
const genql = await createGenqlClient({ shopifyDomain, acessToken });
return genql.mutation({
eventBridgeWebhookSubscriptionCreate: {
...
},
});
} With the export const shopifyConfig = shopifyApp({
...
webhooks: {
...
},
hooks: {
async afterAuth({ session, admin }) {
console.time("registerWebhook()");
await shopifyConfig.registerWebhooks({ session });
console.timeEnd("registerWebhook()"); // ~9/10s
}
},
}); Initially I thought the biggest problem is in the call to
Also, there seems to be a problem even with the I have my app under the export const findShop = async ({ shopifyDomain }: ShopifyDomain) => {
const shop = await db.$queryRaw<[Shop]>`
select * from "Shop" where "shopifyDomain" = ${shopifyDomain};`;
return shop[0];
}; When I have the call to async afterAuth({ admin, session }) {
await Promise.all([
shopifyConfig.registerWebhooks({ session }),
installOrUpdateShop(admin, session),
]);
} The model correctly returns the I forgot to mention that my |
Hi yes, could you create a separate issue for the And then I will triage the |
Excellent, thank you so much! |
Hi @lizkenyon , any updates on this? |
Hi there 👋 Sorry for the delay in this. If you haven't already I would recommend checking out App-specific webhook subscriptions. You define the webhook subscriptions in the |
Hi! I am aware of the that and I already moved some webhooks like |
I noticed the LCP in my app has been raised recently, so after some debugging I found that the call to
registerWebhooks()
in theafterAuth()
hook is taking an exagerate amount of seconds (~10s).Manually registering all my webhooks topic (I currently have 12 topics) inside a
Promise.all()
decreased the time to 300ms.The text was updated successfully, but these errors were encountered: