App reviews, troubleshooting, and recommendations
I'm developing an app for Shopify using a remix template. The documentation states that for such templates, subscription to webhook topics occurs by adding the webhook configuration to the shopifyApp function:
webhooks: {
APP_UNINSTALLED: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: "/webhooks",
},
BULK_OPERATIONS_FINISH: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: "/webhooks"
}
},
hooks: {
afterAuth: async ({ session }) => {
shopify.registerWebhooks({ session });
},
},
And this is my query for bulk operation:
export const getOrdersBulk = `
mutation {
bulkOperationRunQuery(
query: """
{
orders {
edges {
node {
id
createdAt
netPaymentSet {
shopMoney {
amount
currencyCode
}
}
fullyPaid
}
}
}
}
"""
) {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}`;
Query completes, and in response i get { id: 'gid://shopify/BulkOperation/3964961849649', status: 'CREATED' };
But webhook BULK_OPERATIONS_FINISH is not firing at all. Can you help me, maybe i get something wrong?
I am facing the same issue. BULK_OPERATIONS_FINISH webhook is not firing. Did anyone find out what could be wrong?
Yes, i`m solved it. My problem was in webhook registration mechanism. By default webhooks registration happens in hook afterAuth at example, that i provided in first message. When you starded dev script, you can reinstall the app, for webhooks second registration.
For now i`m looking for a better solution, but for now it works:
export async function loader({ request }) {
const { session } = await authenticate.admin(request);
await shopify.registerWebhooks({ session });
return json({
polarisTranslations: require('@shopify/polaris/locales/en.json'),
apiKey: process.env.SHOPIFY_API_KEY,
});
}
in root.tsx loader, i`m just calling shopify.registerWebhooks, and it works fine.
Originally, i got this answer from twitter user with nickname: kinngh .
I hope this helps you)
Thanks, I ended up calling registerWebhooks inside the shopify.server (I am using remix framework btw).
import "@shopify/shopify-app-remix/adapters/node";
import {
AppDistribution,
DeliveryMethod,
shopifyApp,
LATEST_API_VERSION,
} from "@shopify/shopify-app-remix/server";
import { PrismaSessionStorage } from "@shopify/shopify-app-session-storage-prisma";
import { restResources } from "@shopify/shopify-api/rest/admin/2023-10";
const shopify = shopifyApp({
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
apiVersion: LATEST_API_VERSION,
scopes: process.env.SCOPES?.split(","),
appUrl: process.env.SHOPIFY_APP_URL || "",
authPathPrefix: "/auth",
sessionStorage: new PrismaSessionStorage(prisma),
distribution: AppDistribution.AppStore,
restResources,
webhooks: {
APP_UNINSTALLED: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: "/webhooks",
},
BULK_OPERATIONS_FINISH: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: "/xxx",
},
},
hooks: {
afterAuth: async ({ session }) => {
shopify.registerWebhooks({ session });
},
},
future: {
v3_webhookAdminContext: true,
v3_authenticatePublic: true,
},
...(process.env.SHOP_CUSTOM_DOMAIN
? { customShopDomains: [process.env.SHOP_CUSTOM_DOMAIN] }
: {}),
});
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024