Skip to content

Nuxt 3.15.4 and Sentry Nuxt lead to Memory Leak #17555

Closed as not planned
Closed as not planned

Description

@PhilippLupo

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

10.8.0

Framework Version

10.8.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

Package Lock Versions:

 "node_modules/nuxt": {
      "version": "3.15.4",
      "resolved": "https://registry.npmjs.org/nuxt/-/nuxt-3.15.4.tgz",
      "integrity": "sha512-hSbZO4mR0uAMJtZPNTnCfiAtgleoOu28gvJcBNU7KQHgWnNXPjlWgwMczko2O4Tmnv9zIe/CQged+2HsPwl2ZA==",
      "license": "MIT",
 "node_modules/@sentry/nuxt": {
      "version": "10.8.0",
      "resolved": "https://registry.npmjs.org/@sentry/nuxt/-/nuxt-10.8.0.tgz",
      "integrity": "sha512-GdxA7LiVn2EouI2PxNNmHUwtYUrECxDCdW4ARiSgEoKf3/bt8AP7Fi2RvOw2OGVv4Iwn2irDZtbFApsEQqkwSg==",
      "license": "MIT",
      "dependencies": {
        "@nuxt/kit": "^3.13.2",
        "@sentry/browser": "10.8.0",
        "@sentry/cloudflare": "10.8.0",
        "@sentry/core": "10.8.0",
        "@sentry/node": "10.8.0",
        "@sentry/rollup-plugin": "^4.1.1",
        "@sentry/vite-plugin": "^4.1.0",
        "@sentry/vue": "10.8.0"
      },
      "engines": {
        "node": ">=18.19.1"
      },
      "peerDependencies": {
        "nuxt": ">=3.7.0 || 4.x"
      }
    },

modules: [
    ....
    '@sentry/nuxt/module',
],
import * as Sentry from '@sentry/nuxt';
const env = useRuntimeConfig().public.APP_ENV;

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

  // We recommend adjusting this value in production, or using tracesSampler
  // for finer control
  tracesSampleRate: env === 'prod' ? 0.2 : 1.0,

  // This sets the sample rate to be 10%. You may want this to be 100% while
  // in development and sample at a lower rate in production
  replaysSessionSampleRate: 0.1,

  // If the entire session is not sampled, use the below sample rate to sample
  // sessions when an error occurs.
  replaysOnErrorSampleRate: 1.0,

  // If you don't want to use Session Replay, just remove the line below:
  integrations: [Sentry.replayIntegration()],

  // Enable logs to be sent to Sentry
  enableLogs: true,

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

  environment: env,
});
import * as Sentry from '@sentry/nuxt';
import { config } from 'dotenv';

config();

const env = process.env.APP_ENV;

Sentry.init({
  dsn: 'https://.....',

  // We recommend adjusting this value in production, or using tracesSampler
  // for finer control
  tracesSampleRate: env === 'prod' ? 0.2 : 1.0,

  // Enable logs to be sent to Sentry
  enableLogs: true,

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

Steps to Reproduce

I have got a project that is currently running on Nuxt 3.15.4 and wanted to add Sentry.
Therefore I went to the official docs and went by installing it: https://nuxt.com/modules/sentry - nothing special.

Working locally in my DEV environment looks about fine, also the communication with Sentry and the dashboard all work fine.

As in the past I experienced some memory leaks with other Nuxt Modules i did the following:

  • npm run build
  • pm2-runtime .output/server/index.mjs
  • pm2 monit

Then I started my local loadtest by calling all possible url's and I saw the unusualy memory increase, which does not happen if sentry is not installed.

Expected Result

Without it's running pretty stable at around 300MB:

Image

Actual Result

After around 1-2 minutes my application uses already 2GB of memory with Nuxt Sentry (10.8.0) installed:

Image

Activity

  1. linear commented on Sep 8, 2025

    @linear
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Sep 8, 2025
  3. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Sep 8, 2025
  4. s1gr1d commented on Sep 11, 2025

    @s1gr1d
    Member

    Hy, thanks for reaching out!

    Can you upgrade to the latest version of Sentry? Maybe upgrading to the latest version already changes the outcome. If not, we'll have to dig into this.

    And where do you deploy your application to? What OS is this?

  5. tomsdob commented on Sep 22, 2025

    @tomsdob

    Noticed the same issue on "nuxt": "4.1.2" and "@sentry/nuxt": "10.12.0".

    After rollback to "@sentry/vue": "10.12.0", the memory leak issue seems to be gone.

  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Sep 22, 2025
  7. self-assigned this
    on Sep 22, 2025
  8. 46 remaining items

  9. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Nov 7, 2025
  10. Chippd commented on Nov 7, 2025

    @Chippd

    Sorry for the noise I added to this, but my particular problem was solved by reverting to a previous version of Nuxt I know worked for me - 3.17.2 (the workaround of overriding Vue as suggested in this comment was causing me other issues)

    I can confirm that I'm now seeing flat memory usage, with no change to my Sentry implementation.

    Image
  11. s1gr1d commented on Nov 10, 2025

    @s1gr1d
    Member

    Thank you so much for taking the time and trying to track that down with your own implementation!

    To all other people who commented on this issue (@PhilippLupo @tomsdob @bjerggaard @khaled-logihub): Do you still experience memory leaks or can that be resolved with overriding the Vue version like mentioned above?
    To avoid creating noise in the comments, please just react with 👍 if it works for you now and with 👎 if you still experience the issue (with the Vue override).

    As @logaretm mentioned above, he was not able to reproduce this so this might not be a Sentry-only problem.

    However, if your issue persist, please comment your installed versions (from the lock file) of Nuxt, Vue and Nitro (you should also see the Nuxt and Nitro version when starting the build).

  12. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Nov 10, 2025
  13. moved this to Waiting for: Community in GitHub Issues with 👀 3on Nov 10, 2025
  14. removed their assignment
    on Nov 14, 2025
  15. getsantry commented on Dec 5, 2025

    @getsantry

    This issue has gone three weeks without activity. In another week, I will close it.

    But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


    "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

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