Immutable solution version
Shopify API library: catch CookieNotFound on OAuth callback and restart OAuth
Complete solution
When the Shopify OAuth callback throws CookieNotFound, dont treat it as fatal.
When the Shopify OAuth callback throws CookieNotFound, dont treat it as fatal. Wrap shopify.auth.callback in a try/catch, catch the cookie error specifically, and redirect the user back through shopify.auth.begin to restart OAuth. That handles the case where the callback arrives without its cookie and lets the flow recover on its own.
Context: GitHub issue Shopify/shopify-api-js#686 (closed, 42 comments): the OAuth callback kept throwing Could not find an OAuth cookie for the shop URL. A Shopify maintainer's recommended fix: wrap the shopify.auth.callback call in a try/catch and redirect back into the OAuth flow when the CookieNotFound error is thrown, since the cookie can legitimately be missing on a fresh or retried callback.
Evidence
Source: GitHub issue Shopify/shopify-api-js#686 (closed, 42 comments): the OAuth callback kept throwing Could not find an OAuth cookie for the shop URL. A Shopify maintainer's recommended fix: wrap the shopify.auth.callback call in a try/catch and redirect back into the OAuth flow when the CookieNotFound error is thrown, since the cookie can legitimately be missing on a fresh or retried callback.
Verified resolution: When the Shopify OAuth callback throws CookieNotFound, dont treat it as fatal. Wrap shopify.auth.callback in a try/catch, catch the cookie error specifically, and redirect the user back through shopify.auth.begin to restart OAuth. That handles the case where the callback arrives without its cookie and lets the flow recover on its own.
Source URL: https://github.com/Shopify/shopify-api-js/issues/686
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_wKrgLfp15BSpWnsL4JO7uA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Shopify API library: catch CookieNotFound on OAuth callback and restart OAuth <span>— Vectle</span></a>