webhookHandlers error after creating fresh app template

Topic summary

A developer encounters a TypeScript error (code 2322) immediately after creating a fresh Shopify app from the template. The error occurs in index.js and relates to the webhookHandlers configuration, specifically with the GDPR webhook handlers type definition.

Error Details:

  • Type mismatch in webhook handlers object
  • Involves CUSTOMERS_DATA_REQUEST delivery method and callback function
  • Occurs when passing GDPRWebhookHandlers to shopify.processWebhooks()

Code Context:

  • Fresh template installation with standard setup
  • Uses gdpr.js file for GDPR webhook handlers
  • Error appears in the webhook processing configuration

Current Status:
The issue remains unresolved. A second user reports experiencing the identical error, indicating this may be a template-wide problem rather than an isolated configuration issue. No solutions have been proposed yet.

Summarized with AI on November 20. AI used: claude-sonnet-4-5-20250929.

Hello,

I’m new to learning how to build a app with Shopify, but I am getting a error right away on a freshly created template in my index.js file. I have attached the error message below. I am not sure what I am missing, as I just freshly created the template. I have also attached the code from the index.js below.

Thanks for any any help on this

ERROR MESSAGE:

[{> “resource”: “/Users/home/devFiles/appName/web/index.js”,> “owner”: “typescript”,> “code”: “2322”,> “severity”: 8,> “message”: "Type '{ CUSTOMERS_DATA_REQUEST: { deliveryMethod: DeliveryMethod; callbackUrl: string; callback: (topic: any, shop: any, body: any, webhookId: any) => Promise

index.js

// @ts-check
import { join } from "path";
import { readFileSync } from "fs";
import express from "express";
import serveStatic from "serve-static";

import shopify from "./shopify.js";
import productCreator from "./product-creator.js";
import GDPRWebhookHandlers from "./gdpr.js";

const PORT = parseInt(process.env.BACKEND_PORT || process.env.PORT, 10);

const STATIC_PATH =
  process.env.NODE_ENV === "production"
    ? `${process.cwd()}/frontend/dist`
    : `${process.cwd()}/frontend/`;

const app = express();

// Set up Shopify authentication and webhook handling
app.get(shopify.config.auth.path, shopify.auth.begin());
app.get(
  shopify.config.auth.callbackPath,
  shopify.auth.callback(),
  shopify.redirectToShopifyOrAppRoot()
);
app.post(
  shopify.config.webhooks.path,
  shopify.processWebhooks({ webhookHandlers: GDPRWebhookHandlers })
);

// All endpoints after this point will require an active session
app.use("/api/*", shopify.validateAuthenticatedSession());

app.use(express.json());

app.get("/api/products/count", async (_req, res) => {
  const countData = await shopify.api.rest.Product.count({
    session: res.locals.shopify.session,
  });
  res.status(200).send(countData);
});

app.get("/api/products/create", async (_req, res) => {
  let status = 200;
  let error = null;

  try {
    await productCreator(res.locals.shopify.session);
  } catch (e) {
    console.log(`Failed to process products/create: ${e.message}`);
    status = 500;
    error = e.message;
  }
  res.status(status).send({ success: status === 200, error });
});

app.use(serveStatic(STATIC_PATH, { index: false }));

app.use("/*", shopify.ensureInstalledOnShop(), async (_req, res, _next) => {
  return res
    .status(200)
    .set("Content-Type", "text/html")
    .send(readFileSync(join(STATIC_PATH, "index.html")));
});

app.listen(PORT);
2 Likes

Hi Phreaquency, any luck on this? Your post is the only one I found, I have the exact same error.