sentry-javascript
sentry-javascript copied to clipboard
tracingOrigins doesn't work as expected
Is there an existing issue for this?
- [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [X] I have reviewed the documentation https://docs.sentry.io/
- [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/react
SDK Version
7.4.1
Framework Version
7.4.1
Link to Sentry event
No response
Steps to Reproduce
Sentry.init({
dsn: sentryDns,
integrations: [new Integrations.BrowserTracing()],
release: releaseName,
environment,
tracesSampleRate: 0.1,
browserTracingOptions: {
tracingOrigins: [], // <----
},
...
})
I tried also like this,
Sentry.init({
dsn: sentryDns,
integrations: [new Integrations.BrowserTracing({
tracingOrigins: [], // <----
})],
...
both ways sentry-trace
and baggage
still shows in some requests headers.
Expected Result
sentry-trace
and baggage
shouldn't be added to any request.
Actual Result
sentry-trace
and baggage
are attach to some requests header.
Hey thanks for writing in! I wrote up a quick codesandbox to try to reproduce this: https://codesandbox.io/s/tracing-origins-sentry-react-example-xq2biv, but I was not able to.
Could you provide a reproduction to validate this?
Hey @AbhiPrasad, I noticed in your example even if i take off tracingOrigins
its still doesn't send, but in my project its consistently send these props in the header.
Unfortunately, without a repro app it’s really hard for us to tell what’s going on - is it possible for you to share one?
Unfortunately, without a repro app it’s really hard for us to tell what’s going on - is it possible for you to share one?
Yes, it's a private project, is it ok if I'll email you the link to the email written in your profile?
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 label it Status: Backlog
or Status: In Progress
, I will leave it alone ... forever!
"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀
bump
@Danny-weebo Can you please add the following to your code, right after Sentry.init()
, and see what shows up in the console?
console.log("tracingOrigins:",
Sentry.getCurrentHub().getClient()?.getIntegrationById("BrowserTracing")
.options.tracingOrigins
);
@lobsterkatie
@Danny-weebo Can you please add the following to your code, right after
Sentry.init()
, and see what shows up in the console?console.log("tracingOrigins:", Sentry.getCurrentHub().getClient()?.getIntegrationById("BrowserTracing") .options.tracingOrigins );
tracingOrigins: (2) ['localhost', /^\//]
Ah ok so that's the issue, we have a check against empty arrays in the code:
https://github.com/getsentry/sentry-javascript/blob/3203558550e7fd94982d0defe8df65922e1f8342/packages/tracing/src/browser/browsertracing.ts#L145
Opened https://github.com/getsentry/sentry-javascript/pull/5583 to fix this!