Skip to content

@sentry/nuxt breaks Nuxt context for ~1% of requests #15433

Closed as not planned
Closed as not planned
@maxtomczyk

Description

@maxtomczyk

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

9.1.0

Framework Version

3.15.4

Link to Sentry event

No response

Reproduction Example/SDK Setup

const release = `${process.env.NUXT_PUBLIC_APP_NAME}@${ver.replace('v', '')}`

Sentry.init({
  dsn: process.env.NUXT_PUBLIC_SENTRY_DSN,
  environment: process.env.NUXT_PUBLIC_ENVIRONMENT,
  release,
  tracesSampleRate: 0.5,
  debug: true,
})

Steps to Reproduce

  1. Build Nuxt app
  2. Start server with node --import ./dist/apps/core/.output/server/sentry.server.config.mjs ./dist/apps/core/.output/server/index.mjs
  3. Run Grafana K6 to test

Expected Result

All requests are correctly handled.

Actual Result

About 1% of requests fails with 500 status code:

K6 results for node ./dist/apps/core/.output/server/index.mjs:

Image

K6 results for node --import ./dist/apps/core/.output/server/sentry.server.config.mjs ./dist/apps/core/.output/server/index.mjs:

Image

I spent the last few days trying to fix or at least find the cause of this issue. I discovered that the 500 status codes are caused by the nuxt instance unavailable error thrown from the pinia store setup function. It's not logged to console because setup function is called inside vue's runWithContext, which doesn't throw error.

Another clue is the fact that the issue doesn't occur with k6 simultaneity set to 1, which makes me believe it may be some race condition introduced by @sentry/node.

Also, commenting maybeInitializeEsmLoader function call in @sentry/node, while it's not a solution, maybe it will make it easier to find root cause.

I'm aware that this issue provides a small number of details, but unfortunately, I'm not able to share the codebase with you, however, I will be happy to provide you more details as needed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Waiting for: Community

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions