Issue with shop/redact Webhook – 100% Failed Delivery Rate

Hi,
I’m encountering an issue with the shop/redact mandatory webhook. It currently shows a 100% failed delivery rate.

My app does not store any customer data from the shop. It only stores the shop’s name and domain, and even that is deleted immediately when the app receives an app/uninstall webhook.

Here’s the current code I use to handle mandatory webhooks:

import { authenticate } from "../shopify.server";
import crypto from "crypto";
import { json } from "@remix-run/node";

export const action = async ({ request }) => {
  const rawPayload = await request.text();

  const { shop, topic } = await authenticate.webhook(request);
  console.log(`Received ${topic} webhook from ${shop}`);

  const signature = request.headers.get("x-shopify-hmac-sha256");
  const expectedSignature = crypto
    .createHmac("sha256", process.env.SHOPIFY_API_SECRET || "")
    .update(rawPayload)
    .digest("base64");

  if (signature !== expectedSignature) {
    console.error("Invalid webhook signature");
    return json({ message: "Invalid signature" }, { status: 401 });
  }

  return json({ success: true });
};

export const loader = () => new Response(null, { status: 405 });

It used to work fine — the app successfully received and responded to the shop/redact webhook — but starting last week, the delivery show failing.

I believe I’m handling the webhook correctly and returning a 200 OK response, which is all that should be required if the app doesn’t store any customer data.

Could you help me understand what might be causing the failed deliveries?

Thanks in advance!

Hi Tri_t_minh.

You can see the log of your webhook by going to your Shopify Partners > your app > Insights > Webhook topics. Click on the topic that’s failing, and you’ll see the logs for that topic.

I suggest checking the endpoint is correct, it might be worth checking the TOML file for your app too, ensuring the correct webhook details are saved.

Hi Tri_t_minh,
Do you have some logging feature on your end point when webhooks hit your end points. This will help you identofy if webhooks are getting triggered or not.

If these hooks are reashing your end point then check by logging your code response to this webhooks.

As either due to some firewall etc either the webhooks are not hitting your end points(log will clarify if this is the case) or your responses have some wrong format which can be checked by loggin response.