Hey,
I am trying to get my old shopify app back up and running but I am having an issue in that when there is no shop in the active shopify shops object then the app screen is simply blank. The app should redirect to the domain/auth and create a new session except nothing happens and there is no redirect.
router.get("(.*)", async (ctx) => {
const shop = ctx.query.shop;
if (shop) {
ctx.res.setHeader(
"Content-Security-Policy",
`frame-ancestors https://${ctx.query.shop} https://admin.shopify.com;`
);
}
// This shop hasn't been seen yet, go through OAuth to create a session
if (ACTIVE_SHOPIFY_SHOPS[shop] === undefined) {
console.log("If you see this you are here", shop);
ctx.redirect(`https://raven-major-globally.ngrok-free.app/auth?shop=${shop}`);
} else {
await handleRequest(ctx);
}
});
This is the code that is supposed to redirect to create a new auth session but it just returns a 200 code and no redirect happens afterwards. Can someone help? I know the code is being executed since I can see the console log in the server logs.
Also just wanted to add when I manually type in the URL into the browser for example https://myserver/auth?shop=myshop.myshopify.com it actually works and redirects to the app page but for some reason the redirect isn’t working when I open the app from the store page.