-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
7.109.0
Framework Version
Hapi v21.3.7
Link to Sentry event
SDK Setup
Sentry.init({
env: 'local',
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
integrations: [
new Sentry.Integrations.Hapi({server}),
],
beforeSend(event) {
// Logging to disk so as not generate any extra breadcrumbs
fs.appendFileSync(debug.${TEST_NAME}.json, JSON.stringify({event}, null, ' ') + '\n');
return event;
},
});
Steps to Reproduce
I've created a repo to illustrate the issue. Simply follow the readme instructions to reproduce.
In a nutshell, two parallel requests made to different endpoints will result in the state of breadcrumbs and tags.transaction being mixed together. There are three test scenarios each of which exhibits a slightly different set of behaviors.
- Synchronous Request handlers
- Asynchronous request handlers
- Asynchronous request handlers where the handler is wrapped with Sentry.runWithAsyncContext
Expected Result
That sentry events have state that is isolated per request.
Actual Result
The state of the Sentry events being captured contains state from other requests. The aforementioned repo shows three different ways this can happen, each of which has a slightly different behavior. Here are basic descriptions of these scenarios and links to actual Sentry events produced.
Synchronous Request Handlers: One event is correct, but one event contains the breadcrumbs that weren't produced by the request.
Asynchronous Request Handlers: The breadcrumbs for the events are mixed, and tags.transaction shows the incorrect value for one event.
- Breadcrumbs from another request included and wrong transaction
- breadcrumbs from another request included
Asynchronous Requests Handlers Wrapped with Sentry.runWithAsyncContext: The breadcrumbs are lost, and tag.transaction is incorrect.
Metadata
Metadata
Assignees
Labels
Projects
Status