sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

tracingOrigins doesn't work as expected

Open dannyblv opened this issue 2 years ago • 6 comments

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.

dannyblv avatar Jul 08 '22 11:07 dannyblv

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?

AbhiPrasad avatar Jul 11 '22 14:07 AbhiPrasad

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.

dannyblv avatar Jul 17 '22 06:07 dannyblv

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?

AbhiPrasad avatar Jul 18 '22 14:07 AbhiPrasad

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?

dannyblv avatar Jul 18 '22 16:07 dannyblv

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 🥀

github-actions[bot] avatar Aug 09 '22 00:08 github-actions[bot]

bump

dannyblv avatar Aug 10 '22 11:08 dannyblv

@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 avatar Aug 11 '22 20:08 lobsterkatie

@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', /^\//]

dannyblv avatar Aug 14 '22 11:08 dannyblv

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!

AbhiPrasad avatar Aug 15 '22 14:08 AbhiPrasad