[Bug]: `theme dev` proxy 502s on cookie-heavy storefront responses (undici default 16 KiB `maxHeaderSize`)
Les mainteneurs répondent en général sous 2 jours
@efegokdemir y travaille déjà.
Depuis le 2/10/2026.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 68/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- node.js, typescript
Piste de recherche
Start by tracing the theme dev storefront proxy path that forwards requests and handles upstream fetch errors; the report does not name a source file or test. Reproduce with a cookie-heavy response and inspect how the proxy configures undici and turns failures into 502s. Done means the response succeeds above the default header limit and the overflow cause is actionable in the error output.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
[Bug]: theme dev proxy 502s on cookie-heavy storefront responses (undici default 16 KiB maxHeaderSize)
Description
shopify theme dev renders all pages as 502 ("Failed to render storefront") once the browser has cookies for the store. The storefront proxy dies parsing the upstream response headers: the response to a cookie'd request carries enough Set-Cookie headers to exceed undici's default 16 KiB header limit. The undici error (UND_ERR_HEADERS_OVERFLOW) is swallowed and surfaced as a bare TypeError: fetch failed → 502.
The theme, the dev theme, and the store are all fine — a cookie-less request to the same URL renders correctly.
Steps to reproduce
shopify theme pull --liveandshopify theme devon any store whose storefront sets a largeSet-Cookiecollection on cookie'd requests (this merchant: a Plus cosmetics store with cart/localization/tracking cookies).- Visit
http://127.0.0.1:9292/in a browser with an existing cookie jar for the store. - Every page render fails:
Failed to render storefront with status 502 (Bad Gateway).
URL: https://REDACTED-store.myshopify.com/?_fd=0&pb=0
TypeError: fetch failed
at Object.processResponse (node:internal/deps/undici/undici:12793:20)
at async ze (.../@shopify/cli/dist/chunk-CSNXCRPY.js:12:375)
- Open the same URL in an incognito window (empty cookie jar) — it renders.
curlto the same URL renders. Nodefetchfrom a fresh process renders. Only the CLI's cookie-forwarding proxy path fails.
Isolating the real error
The CLI wraps the undici error and drops error.cause. Attaching this shim via NODE_OPTIONS="--require /tmp/shim.cjs" and re-running theme dev reveals the cause:
const orig = globalThis.fetch;
globalThis.fetch = async (...args) => {
try { return await orig(...args); }
catch (e) {
console.error('[fetch-debug] URL:', String(args[0] && (args[0].url || args[0])).slice(0, 200));
console.error('[fetch-debug] cause code:', e.cause && e.cause.code, '| cause:', e.cause && e.cause.message);
throw e;
}
};
Output:
[fetch-debug] URL: https://REDACTED-store.myshopify.com/?_fd=0&pb=0
[fetch-debug] cause code: UND_ERR_HEADERS_OVERFLOW | cause: Headers Overflow Error
at Parser.trackHeader (node:internal/deps/undici/undici:7385:37)
at Parser.onHeaderValue (node:internal/deps/undici/undici:7376:14)
Supporting measurements
- Cookie-less
GET https://REDACTED-store.myshopify.com/?_fd=0&pb=0(with the CLI'sUser-Agent): 200, full 940 KB body, response header block ≈ 7.9 KB — under the 16 KiB cap, no failure. - Same request with the browser's cookie jar forwarded: the storefront returns a much larger
Set-Cookiecollection, pushing the response header block past 16 KiB →UND_ERR_HEADERS_OVERFLOW. - GET and POST (with
replace_templatesform bodies, up to 2 MB) both succeed without cookies, so neither method, body, nor header shape is the trigger — only response header size.
Suggested fix
- Configure the proxy's fetch/
Agentwith a largermaxHeaderSize(e.g. 64–128 KiB) instead of undici's 16 KiB default. Shopify storefronts legitimately set largeSet-Cookiecollections on cookie'd requests. - In the 502 error page, surface
error.cause.code(e.g.UND_ERR_HEADERS_OVERFLOW) instead of only the wrappedTypeError: fetch failedstack — it took aNODE_OPTIONSshim to find the actual cause.
Workaround
Use an incognito/private window for http://127.0.0.1:9292/, or clear site data for 127.0.0.1 and the store domain.
Environment
| CLI version | @shopify/[email protected] (pnpm global) |
| Node | v24.15.0 |
| OS | macOS 15 |
| Store | Shopify Plus storefront |
Possibly related: #8480 (theme dev proxy 502, cause not isolated — same proxy path, this report's cause code may explain it) and #3963.
- Langage dominant
- TypeScript
- Étoiles
- 763
- Forks
- 295
- Merge moyen
- 2 j 11 h
- PR mergées (30 j)
- 179
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Shopify/cli
-
A background token refresh failure in a non-interactive process wipes every saved CLI session (all accounts)Peut-être pris @efegokdemir l’a pris il y a 8 jours. Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
Shopify/cli#8906 · 1 commentaire · 3 réactions ·
Les mainteneurs répondent en général sous 2 jours
-
[Bug]: app deploy fails intermittently with ENOENT on <handle>.js.map when two UI extensions share a folderPeut-être pris @efegokdemir l’a pris il y a 19 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 67/100
Shopify/cli#8823 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
Shopify/cli#8753 · 2 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
[Bug]: `shopify hydrogen dev` exits before listening when the npm registry is unreachable (p-cancelable onCancel-after-settle in latest-version chunk)Peut-être pris @efegokdemir l’a pris il y a 24 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de Shopify/cli
Issues similaires
-
New icon: `filter-clear`Ouvertecalcite-ui-icons enhancement impact - p3 - not time sensitive needs triage
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
Esri/calcite-design-system#15467 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
diegosouzapw/OmniRoute#18390 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
-
Difficulté 1/5 1-3 heures Accessibilité débutants 86/100
guilhermerodz/input-otp#157 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
davidjerleke/embla-carousel#1414 ·
Les mainteneurs répondent en général sous 4 jours