Skip to content

Commit

Permalink
docs(nextjs): Add troubleshooting for OOM (#12093)
Browse files Browse the repository at this point in the history
  • Loading branch information
chargome authored Dec 12, 2024
1 parent 716b2d4 commit 614d0a0
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions docs/platforms/javascript/common/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ Learn more about fixing these caching issues in the <PlatformLink to="/sourcemap
</Expandable>
</PlatformSection>
<PlatformSection notSupported={['javascript.nuxt']}>
Expand All @@ -450,11 +449,11 @@ As a workaround, create or modify `.npmrc` in your project root:
```npmrc
shamefully-hoist=true
```
<Alert level="warning">
**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.
</Alert>
</Expandable>
</PlatformSection>
Expand All @@ -464,7 +463,6 @@ shamefully-hoist=true
`Failed to register ESM hook import-in-the-middle/hook.mjs`. You can add an override (npm/pnpm) or a resolution (yarn)
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).
Nitro updated `@vercel/nft` in Nitro version `2.10.0`, so you might not get this error anymore, and you don't need to
add this override/resolution.
Expand Down Expand Up @@ -500,6 +498,7 @@ shamefully-hoist=true
```bash
pnpm add import-in-the-middle
```
</Expandable>
<Expandable permalink title="Nuxt: Server-side Nitro is not sending events">
Expand Down Expand Up @@ -537,6 +536,25 @@ shamefully-hoist=true
}
}
```
</Expandable>
</PlatformSection>
<PlatformSection supported={['javascript.nextjs']}>
<Expandable permalink title="Out of Memory (OOM) errors during build">
The problem here is related to memory consumption during the build process, especially when generating source maps. Here are some potential solutions and workarounds:
- Update your `@sentry/nextjs` package to the latest version.
- 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.
- Disable source maps entirely: As a last resort, you can disable source map generation completely:
```js {filename:next.config.js}
module.exports = withSentryConfig(module.exports, {
sourcemaps: {
disable: true,
},
}
```
</Expandable>
</PlatformSection>
Expand Down

0 comments on commit 614d0a0

Please sign in to comment.