I’ve created an app using the Shopify CLI with the Node template. In the app.toml file , I set automatically_update_urls_on_dev = true, so when I start the server, the URLs update automatically. However, when I open my app, I encounter the following error: ‘ensureInstalledOnShop Did not receive a shop query argument shop: undefined.’ Could someone please help me resolve this issue?
Same problem
ensureInstalledOnShop Did not receive a shop query argument shop: undefined.’
same here too.. ![]()
I am facing the same issue today. Can someone tell me why this is happening??
// custom middleware for shop query parameter
const addSessionShopToReqParams = (req, res, next) => {
const shop = res.locals?.shopify?.session?.shop;
if (shop && !req.query.shop) {
req.query.shop = shop;
}
console.log("SHOP:", shop, req.query.shop);
return next();
};
Now use the above middleware just below the validateAuthenticatedSession middelware as follows:
app.use("/api/*", shopify.validateAuthenticatedSession());
app.use("/*", addSessionShopToReqParams);