App reviews, troubleshooting, and recommendations
Hello,
I'm using the latest remix template and registered an orders/create webhook. On Vercel I'm getting with this code many 422 errors. These 422 don't even get send to the webhook destination. It seems like there is something wrong and the error occurs before sending.
Does anyone has the same problem?
Here is my code:
webhooks.jsx
import { authenticate } from "../shopify.server"; import db from "../db.server"; export const action = async ({ request }) => { const { topic, shop, session, admin, payload } = await authenticate.webhook(request); if (!admin) { // The admin context isn't returned if the webhook fired after a shop was uninstalled. throw new Response(); } switch (topic) { case "APP_UNINSTALLED": if (session) { await db.session.deleteMany({ where: { shop } }); } break; case "ORDERS_CREATE": if (session) { console.log(payload); const webhook = new admin.rest.resources.Webhook({session: session}); webhook.topic = "orders/create"; webhook.address = "URL"; webhook.format = "json"; webhook.save({ update: true, }); } break; case "CUSTOMERS_DATA_REQUEST": case "CUSTOMERS_REDACT": case "SHOP_REDACT": default: throw new Response("Unhandled webhook topic", { status: 404 }); } throw new Response(); };
Part of the shopify.server.js code
webhooks: { APP_UNINSTALLED: { deliveryMethod: DeliveryMethod.Http, callbackUrl: "/webhooks", }, ORDERS_CREATE: { deliveryMethod: DeliveryMethod.Http, callbackUrl: "/webhooks", }, },
Would be awesome if someone knows the answer!
Best regards
Lukas
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025