Draft Order Update webhook not firing on Draft Order -> Order creation

When creating a draft order, the draft_orders/create fires. When this Draft Order is converted to an Order, it should also fire a draft_orders/update webhook (which it’s skipping) and directly heading over to firing orders/create and orders/updated webhooks like normal.

Created an app to simulate a single draft order → order conversion and even the dashboard confirms the webhook was never fired

Hey @kinngh :waving_hand: - I just tested this on my end here to try to replicate and I did get a draft_orders/update payload to fire to my webhook endpoint after it was converted into a “full” order, so it is definitely odd that it didn’t trigger for you.

Would you be able to share an order ID for an example order that was converted from a draft order initially as well as your webhook subscription’s endpoint? We can take a look in our logs on our end to see if we can see if the webhook didn’t trigger when the order was created or if something else may have caused this.

Hope to hear from you soon!

Hey hey! it was heuras-test-store.myshopify.com with Order ID gid://shopify/Order/6010382778456 that I used for this test.

The way I caught on with this is my app, Yakk, relies on this transitional webhook to associate a draft order with order and then split it, and for a few hours I had 0 conversions because of this webhook not firing at all^

Happy to share any more info that would help with debugging this!

Also, here’s the TOML from the test:

[[webhooks.subscriptions]]
  topics = [
  "orders/create",
  "orders/updated",
  "draft_orders/create",
  "draft_orders/update"
]
  uri = "https://facility-hurricane-ak-acquired.trycloudflare.com/api/webhooks/orders"

And this is the handler function:

import fs from "fs";
const testHandler = async (
  topic,
  shop,
  webhookRequestBody,
  webhookId,
  apiVersion
) => {
  try {
    /** @type {webhookTopic} */
    const webhookBody = JSON.parse(webhookRequestBody);

    console.log(topic);

    fs.writeFile(
      `${Date.now()}-${topic}.json`,
      JSON.stringify({ topic, webhookBody }, null, 2),
      (e) => console.log(e)
    );
  } catch (e) {
    console.error("---> An error occured at /webhooks/TOPIC_NAME", e);
  }
};

export default testHandler;

And it never wrong a Draft Orders Update file

Did you encounter any exception messages while executing the ‘npm run deploy’ command

shopify app deploy didn’t return anything that was breaking in this case. The webhook did stop firing for both my production and staging apps too - which broke everything^

Are there any other logs that I can get you to make this easier? For staging, these order names didn’t get through:

Store: heuras-checkout-branding-store.myshopify.com
Orders: #1914, #1915, #1916, #1917
App: Yakk: Bulk & Corporate Gifting

These orders are still not processed because the webhook never fired. The idea here is we take in bulk orders and then split them for each recipient - there’s this gap in orders (these are in a dev store so technically they should be split) which leads me to believe the webhook still never fired for these^

Edit: I had to write an identifier and watch for orders webhooks to map a Draft Order to Order since the webhook wasn’t firing, which is why #1918 onwards it’s working fine

Also, a thing to note is the webhooks are firing just fine, but till the message about my TOML config and related, it wasn’t firing. Exact same test app and code, but this time it fired as expected - I’m guessing some downtime?