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
- Build Nuxt app
- Start server with
node --import ./dist/apps/core/.output/server/sentry.server.config.mjs ./dist/apps/core/.output/server/index.mjs
- 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:

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

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.
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
Steps to Reproduce
node --import ./dist/apps/core/.output/server/sentry.server.config.mjs ./dist/apps/core/.output/server/index.mjsExpected 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:K6 results for
node --import ./dist/apps/core/.output/server/sentry.server.config.mjs ./dist/apps/core/.output/server/index.mjs: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 unavailableerror thrown from the pinia store setup function. It's not logged to console becausesetupfunction is called inside vue'srunWithContext, 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
maybeInitializeEsmLoaderfunction 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.