Skip to content

Memory leak with nuxt build #16482

Closed
Closed

Description

@SwartZCoding

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

"@sentry/browser": "^9.25.1",
"@sentry/nuxt": "^9.19.0",

Framework Version

nuxt 3.16.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

Hello guys ! Since i have installed sentry on my nuxt project. My github action run out of memory...

I think this is the same issue of but on nextjs : #12317

I have already try to increase on my actions the NODE_OPTIONS=--max_old_space_size=8192

My sentry client config :

import * as Sentry from "@sentry/nuxt";

Sentry.init({
// If set up, you can use your runtime config here
// dsn: useRuntimeConfig().public.sentry.dsn,
dsn: "",

// We recommend adjusting this value in production, or using tracesSampler
// for finer control
tracesSampleRate: 1.0,

// Setting this option to true will print useful information to the console while you're setting up Sentry.
debug: false,

beforeSend(event, hint) {
const error = hint.originalException;
if (
error &&
typeof error.message === 'string' &&
error.message.includes("window.webkit.messageHandlers")
) {
return null; // ignore
}
return event;
}
});

Config on nuxt.config :

sentry: {
sourceMapsUploadOptions: {
org: 'XXXXX',
project: 'XXXXX',
authToken: "XXXX",
}
},

sourcemap: {
client: 'hidden'
}

Steps to Reproduce

  1. Create a nuxt project
  2. setup a sentry into it
  3. Try to build it with github actions

Expected Result

Don't get out of memory...

Actual Result

[6/6] RUN npm run build:
127.9 <--- JS stacktrace --->
127.9
127.9 FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
127.9 ----- Native stack trace -----
127.9
159.4 npm error path /app/front
159.4 npm error command failed
159.4 npm error signal SIGABRT

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jun 4, 2025
  2. s1gr1d commented on Jun 4, 2025

    @s1gr1d
    Member

    Hello, please only install the @sentry/nuxt SDK as it uses the browser SDK under the hood and it ensures that all SDKs are installed with the same version. Different versions could lead to unexpected issues. While I think the version mismatch is not the cause here, can you still try if this already fixes the problem?

    Memory issues could also occur because of source maps generation. If you disable source maps generation on the server with false, do you still experience the memory leak?

  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jun 4, 2025
  4. moved this to Waiting for: Community in GitHub Issues with 👀 3on Jun 4, 2025
  5. SwartZCoding commented on Jun 4, 2025

    @SwartZCoding
    Author

    Hello, please only install the @sentry/nuxt SDK as it uses the browser SDK under the hood and it ensures that all SDKs are installed with the same version. Different versions could lead to unexpected issues. While I think the version mismatch is not the cause here, can you still try if this already fixes the problem?Memory issues could also occur because of source maps generation. If you disable source maps generation on the server with false, do you still experience the memory leak?

    Hi ! Just try to reinstall sentry only the nuxt sdk and the error still happened.

    I have try with same config, i got out of memory.

    If i disabled server: false into sourcemap config in nuxt.config.ts it's seems to work. But with this param, i'm gonna lost all my sourcemap to identify issue no ?

  6. moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3on Jun 4, 2025
  7. s1gr1d commented on Jun 5, 2025

    @s1gr1d
    Member

    Then it's probably related to source maps. Nitro creates a very big chunk which creates a large source map in memory. Currently, there is no good way of chunking source maps. It's a general problem with the source map spec itself. You can read more here: getsentry/sentry-javascript-bundler-plugins#683 (comment)

    But you are right, setting sourcemap: false would disable source map generation for you. Do you have a very large project?

  8. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jun 5, 2025
  9. moved this to Waiting for: Community in GitHub Issues with 👀 3on Jun 5, 2025
  10. SwartZCoding commented on Jun 5, 2025

    @SwartZCoding
    Author

    Then it's probably related to source maps. Nitro creates a very big chunk which creates a large source map in memory. Currently, there is no good way of chunking source maps. It's a general problem with the source map spec itself. You can read more here: getsentry/sentry-javascript-bundler-plugins#683 (comment)

    But you are right, setting sourcemap: false would disable source map generation for you. Do you have a very large project?

    I don’t think it’s a very big project. But yes it’s a saas project.

  11. moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3on Jun 5, 2025
  12. s1gr1d commented on Jun 5, 2025

    @s1gr1d
    Member

    We'll come back to you if there are any updates on this. For the time being, you can also subscribe to the other issue in the bundler plugins related to this.

  13. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jun 5, 2025
  14. s1gr1d commented on Aug 4, 2025

    @s1gr1d
    Member

    A new PR was merged to the bundler plugins: getsentry/sentry-javascript-bundler-plugins#761

    This PR adds some build-time improvements and can help here. I will close the issue now. In case it's still a problem, we can always re-open it.

    The Nuxt SDK uses the bundler plugins under the hood, so you don't need to explicitly install them. The change will be reflected when updating @sentry/nuxt to v10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions