I’m in the the fourth part (Build your user interface with Polaris) of this tutorial.
The first time I attempt to load the App’s homepage, the following page appears for an instant:
The second time I load the homepage, it appears fine
When I try to access [app_homepage]/annotated-layout, the same sequence follows, except that I arrive here instead:
Considering the connection limit inherent to Ngrok, I tried the same approach using Local Tunnel. And the same sequence of events took place, except that for annotated-layout I keep arriving at the ‘undefined’ error page after the flashing ‘enable cookies’ page. After four attempts, Shopify redirects to admin/apps with the following warning:

But this happens even after I’ve added [store_domain].myshopify.com in Sites that can always use cookies in Chrome (v91.0.4472.77) settings.
I’ve checked the Ngrok/LocalTunnel address in the App setup ( in App URL and Allowed redirection URL(s) ) and in the .env file of the app. I also checked the annotated-layout page URL (compared to the filename in pages directory) and tried clearing cookies. By checking the server logs I can see that the request doesn’t even hit the server.
I tried using Safari (v14.0.2) and it doesn’t work either, with the difference that the browser stays on the ‘enable cookies’ instead of just flashing it. I’m using the latest version of koa-shopify-auth (4.1.3) and I’ve double-checked the code in server.js to verify it matches the one in the tutorial.
The last fix I attempted was adding the following inside the afterAuth(ctx) block (with and without the domain key):
[...]
const { shop, scope } = ctx.state.shopify;
ctx.res.setHeader('Set-Cookie', cookie.serialize('shopOrigin', shop, {
sameSite: 'none',
secure: true,
domain: process.env.SHOPIFY_APP_URL.replace(/https:\/\//,""),
}))
ACTIVE_SHOPIFY_SHOPS[shop] = scope;
[...]
After doing this, instead of failing it just keeps redirecting to the apps homepage.



