apollographql / apollographql/apollo-client-integrations

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Open
#480 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
556
Forks
53
PR merge metrics
No merged PRs in 30d

Description

After adding the integration to a project Netlify build is throwing:
```sh

3:31:34 PM: ~/e21adb24-2d80-432f-8cda-71d46176ba8f-15.js.map (debug id e21adb24-2d80-432f-8cda-71d46176ba8f)
3:31:34 PM: [@sentry/nextjs - Client] Info: Successfully uploaded source maps to Sentry
3:31:46 PM: <--- Last few GCs --->
3:31:46 PM: [7599:0xdf10000] 100443 ms: Mark-Compact 1922.3 (2093.5) -> 1917.5 (2087.5) MB, pooled: 32 MB, 822.32 / 0.00 ms (average mu = 0.052, current mu = 0.026) allocation failure; GC in old space requested
3:31:46 PM: [7599:0xdf10000] 100983 ms: Mark-Compact 1924.8 (2093.5) -> 1855.1 (2028.8) MB, pooled: 37 MB, 483.79 / 0.00 ms (average mu = 0.072, current mu = 0.104) external memory pressure; scavenge might not succeed
3:31:46 PM: <--- JS stacktrace --->
3:31:46 PM: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
3:31:46 PM: ----- Native stack trace -----
3:31:46 PM: 1: 0xe19de0 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/buildhome/.nvm/versions/node/v22.11.0/bin/node]
3:31:46 PM: 2: 0x1240390 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/buildhome/.nvm/versions/node/v22.11.0/bin/node]
3:31:46 PM: 3: 0x1240667 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/buildhome/.nvm/versions/node/v22.11.0/bin/node]
3:31:46 PM: 4: 0x146e1a5 [/opt/buildhome/.nvm/versions/node/v22.11.0/bin/node]
3:31:47 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
3:31:47 PM: ​
3:31:47 PM: "build.command" failed
3:31:47 PM: ────────────────────────────────────────────────────────────────
3:31:47 PM: ​
3:31:47 PM: Error message
3:31:47 PM: Command failed with exit code 1: yarn build:ci (https://ntl.fyi/exit-code-1)
3:31:47 PM: ​
3:31:47 PM: Error location
3:31:47 PM: In build.command from netlify.toml:
3:31:47 PM: yarn build:ci
```

I'm using preloadQuery along the project and I had to use the `disableFragmentWarnings ` to avoid the fragment warning, could it be that generated-types.ts (and fragments) may be duplicated or recursively referenced ?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure with yarn build:ci and review the Netlify build configuration in netlify.toml. Inspect generated-types.ts and the fragment usage around preloadQuery and disableFragmentWarnings to determine whether duplication or recursive references contribute to the heap exhaustion. Done means identifying the cause and confirming that the build completes without the out-of-memory error.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, node.js, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.