I’ve followed the app configuration on shopify.app.toml and this tutorial
I’m only receiving products/update webhook, the others “inventory_items/update”, and “product_listings/update” are not received nor is there any log on Partners App.
Partner app shows successful delivery of products/update
I’ve done npm run dev – --reset several times and deploy.
# Learn more about configuring your app at https://shopify.dev/docs/apps/tools/cli/configuration
client_id = "abcd"
application_url = "https://ban-courses-sunny-edges.trycloudflare.com"
embedded = false
name = "abcd"
handle = "abcd"
[build]
automatically_update_urls_on_dev = true
dev_store_url = "abcd-dev.myshopify.com"
include_config_on_deploy = true
[webhooks]
api_version = "2024-07"
[[webhooks.subscriptions]]
topics = [
"inventory_items/update",
"product_listings/update",
"products/update"
]
uri = "https://mergn.free.beeceptor.com"
[access_scopes]
# Learn more at https://shopify.dev/docs/apps/tools/cli/configuration#access_scopes
scopes = "read_customer_events,read_inventory,read_pixels,read_product_listings,read_products,write_pixels"
[auth]
redirect_urls = [
"https://ban-courses-sunny-edges.trycloudflare.com/auth/callback",
"https://ban-courses-sunny-edges.trycloudflare.com/auth/shopify/callback",
"https://ban-courses-sunny-edges.trycloudflare.com/api/auth/callback",
"https://frontend-git-dev-mergns-projects.vercel.app/api/shopify/auth/callback"
]
[pos]
embedded = false
My server file config
import "@shopify/shopify-app-remix/adapters/node";
import {
ApiVersion,
AppDistribution,
DeliveryMethod,
shopifyApp,
} from "@shopify/shopify-app-remix/server";
import { PrismaSessionStorage } from "@shopify/shopify-app-session-storage-prisma";
import { restResources } from "@shopify/shopify-api/rest/admin/2024-04";
import prisma from "./db.server";
const shopify = shopifyApp({
isEmbeddedApp: false,
apiKey: process.env.SHOPIFY_API_KEY,
apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
apiVersion: ApiVersion.April24,
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",
},
PRODUCTS_UPDATE: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: "/webhooks",
},
PRODUCT_LISTINGS_UPDATE: {
deliveryMethod: DeliveryMethod.Http,
callbackUrl: "/webhooks",
},
},
hooks: {
afterAuth: async ({ session }) => {
console.log("? ~ afterAuth: ~ session:", session);
await shopify.registerWebhooks({ session });
console.log("? ~ afterAuth: ~ webhooks registered");
},
},
future: {
unstable_newEmbeddedAuthStrategy: true,
},
...(process.env.SHOP_CUSTOM_DOMAIN
? { customShopDomains: [process.env.SHOP_CUSTOM_DOMAIN] }
: {}),
});
export default shopify;
export const apiVersion = ApiVersion.July24;
export const addDocumentResponseHeaders = shopify.addDocumentResponseHeaders;
export const authenticate = shopify.authenticate;
export const unauthenticated = shopify.unauthenticated;
export const login = shopify.login;
export const registerWebhooks = shopify.registerWebhooks;
export const sessionStorage = shopify.sessionStorage;
Despite doing the reset, none of the webhooks in the server object are working. I’ve logs correctly set in webhooks file
import type { ActionFunctionArgs } from "@remix-run/node";
import { authenticate } from "../shopify.server";
import db from "../db.server";
export const action = async ({ request }: ActionFunctionArgs) => {
const { topic, shop, session, admin } = await authenticate.webhook(request);
console.log("? ~ action ~ session:", session);
console.log("? ~ action ~ shop:", shop);
console.log("? ~ action ~ topic:", topic);
if (!admin) {
// The admin context isn't returned if the webhook fired after a shop was uninstalled.
throw new Response();
}
// The topics handled here should be declared in the shopify.app.toml.
// More info: https://shopify.dev/docs/apps/build/cli-for-apps/app-configuration
switch (topic) {
case "APP_UNINSTALLED":
if (session) {
await db.session.deleteMany({ where: { shop } });
}
break;
case "CUSTOMERS_DATA_REQUEST":
case "CUSTOMERS_REDACT":
case "SHOP_REDACT":
break;
default:
throw new Response("Unhandled webhook topic", { status: 404 });
}
throw new Response();
};