Skip to content

Commit 614d0a0

Browse files
authored
docs(nextjs): Add troubleshooting for OOM (#12093)
1 parent 716b2d4 commit 614d0a0

File tree

1 file changed

+21
-3
lines changed
  • docs/platforms/javascript/common/troubleshooting

1 file changed

+21
-3
lines changed

docs/platforms/javascript/common/troubleshooting/index.mdx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,6 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
431431
432432
</Expandable>
433433
434-
435434
</PlatformSection>
436435
437436
<PlatformSection notSupported={['javascript.nuxt']}>
@@ -450,11 +449,11 @@ As a workaround, create or modify `.npmrc` in your project root:
450449
```npmrc
451450
shamefully-hoist=true
452451
```
452+
453453
<Alert level="warning">
454454
**Note**: While `shamefully-hoist=true` usually isn't the ideal solution from a dependency management perspective, it's sometimes necessary for compatibility with certain packages that expect Node.js module resolution behavior similar to npm or yarn.
455455
</Alert>
456456
457-
458457
</Expandable>
459458
</PlatformSection>
460459
@@ -464,7 +463,6 @@ shamefully-hoist=true
464463
`Failed to register ESM hook import-in-the-middle/hook.mjs`. You can add an override (npm/pnpm) or a resolution (yarn)
465464
for `@vercel/nft` to fix this. This will add the `hook.mjs` file to your build output. See the [underlying issue in the UnJS Nitro project](https://github.com/unjs/nitro/issues/2703).
466465
467-
468466
Nitro updated `@vercel/nft` in Nitro version `2.10.0`, so you might not get this error anymore, and you don't need to
469467
add this override/resolution.
470468
@@ -500,6 +498,7 @@ shamefully-hoist=true
500498
```bash
501499
pnpm add import-in-the-middle
502500
```
501+
503502
</Expandable>
504503
505504
<Expandable permalink title="Nuxt: Server-side Nitro is not sending events">
@@ -537,6 +536,25 @@ shamefully-hoist=true
537536
}
538537
}
539538
```
539+
540+
</Expandable>
541+
</PlatformSection>
542+
543+
<PlatformSection supported={['javascript.nextjs']}>
544+
<Expandable permalink title="Out of Memory (OOM) errors during build">
545+
The problem here is related to memory consumption during the build process, especially when generating source maps. Here are some potential solutions and workarounds:
546+
547+
- Update your `@sentry/nextjs` package to the latest version.
548+
- Increase Node.js memory limit: You can try increasing the memory limit for Node.js during the build process. Add this to your build command: `NODE_OPTIONS="--max-old-space-size=8192" next build`. This flag will increase the memory available to the node process to 8 GB. We have found that Next.js consumes around 4 GB in most cases. Decrease the size depending on your memory availability.
549+
- Disable source maps entirely: As a last resort, you can disable source map generation completely:
550+
```js {filename:next.config.js}
551+
module.exports = withSentryConfig(module.exports, {
552+
sourcemaps: {
553+
disable: true,
554+
},
555+
}
556+
```
557+
540558
</Expandable>
541559
</PlatformSection>
542560

0 commit comments

Comments
 (0)