Skip to content

build: prevent Oxygen deploy OOM on large storefronts (disable prod sourcemaps + doc heap fix)#444

Open
paul-phan wants to merge 1 commit into
mainfrom
fix/build-oom-guard
Open

build: prevent Oxygen deploy OOM on large storefronts (disable prod sourcemaps + doc heap fix)#444
paul-phan wants to merge 1 commit into
mainfrom
fix/build-oom-guard

Conversation

@paul-phan

Copy link
Copy Markdown
Member

Why

A client storefront built on this theme hit FATAL ERROR: JavaScript heap out of memory (exit 134) during the Oxygen deploy. The production build peaked above the CI runner's default Node heap (~2GB), so the deploy died before uploading a complete build. The environment then served HTML referencing client JS assets that were never published, and the storefront rendered blank (all oxygen-v2/.../assets/*.js returned 404).

To avoid other clients hitting the same wall on large storefronts, harden the base theme.

Changes

  1. vite.config.tsbuild.sourcemap: false. Sourcemap generation is a major memory driver during the production build; disabling it lowers peak memory with no runtime cost.
  2. README.md — document the heap fix (NODE_OPTIONS: --max-old-space-size=8192 on the Oxygen deploy step) for storefronts large enough to still OOM. The deploy workflow is generated per-storefront by Shopify, so this can't live in the theme repo, but the note tells clients exactly where to add it.

Notes

  • manualChunks splitting is already present in this config and is kept.
  • No behavior change at runtime; sourcemaps were only used for build-time debugging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 603c75a6f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vite.config.ts
// Disable sourcemaps in the production build. Sourcemap generation is a
// major memory driver and can push large storefronts past the CI runner's
// default Node heap (~2GB), causing OOM (exit 134) during Oxygen deploys.
sourcemap: false,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disable server sourcemaps in Hydrogen deploys

When the Oxygen workflow uses npx shopify hydrogen deploy, this setting does not disable the expensive server sourcemap build: the installed Shopify CLI's deploy path calls its build helper with sourcemap: true, and that helper passes an inline Vite config for the SSR build (build: { sourcemap: n, ssr: ... }), which takes precedence over vite.config.ts. Large storefront deployments will therefore still generate SSR sourcemaps and can still hit the OOM this commit is meant to avoid unless the deploy uses a custom build command/flag that turns Hydrogen sourcemaps off.

Useful? React with 👍 / 👎.

@paul-phan
paul-phan force-pushed the fix/build-oom-guard branch from 603c75a to 6dbd177 Compare July 8, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant