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

When loading Sentry's Javascript SDK using a CDN, the performance monitoring piece should be loaded in a different way

Open yuval-sentry opened this issue 3 years ago • 9 comments

Core or SDK?

Platform/SDK

Which part? Which one?

Javascript

Description

In this doc: https://docs.sentry.io/platforms/javascript/install/cdn/ It shows that in order to init our performance monitoring you need to use this code:

Sentry.init({
  dsn: "https://[email protected]/0",
  // this assumes your build process replaces `process.env.npm_package_version` with a value
  release: "my-project-name@" + process.env.npm_package_version,
  integrations: [new Sentry.BrowserTracing()],

  // We recommend adjusting this value in production, or using tracesSampler
  // for finer control
  tracesSampleRate: 1.0,
});

But it doesn't work, instead of

integrations: [new Sentry.BrowserTracing()]

it should be:

integrations: [new Sentry.Integrations.BrowserTracing()],

*** That's true only when using our CDN

Suggested Solution

instead of

integrations: [new Sentry.BrowserTracing()] 

it should be:

integrations: [new Sentry.Integrations.BrowserTracing()],

*** That's true only when using our CDN

yuval-sentry avatar Jun 17 '22 20:06 yuval-sentry

Routing to @getsentry/app-frontend for triage. ⏲️

getsentry-release avatar Jun 20 '22 13:06 getsentry-release

Routing to @getsentry/team-web-sdk-frontend for triage. ⏲️

getsentry-release avatar Jun 20 '22 13:06 getsentry-release

Routing to @getsentry/app-frontend for triage. ⏲️

getsentry-release avatar Jun 20 '22 13:06 getsentry-release

Routing to @getsentry/app-frontend for triage. ⏲️

getsentry-release avatar Jun 20 '22 13:06 getsentry-release

Routing to @getsentry/team-web-sdk-frontend for triage. ⏲️

getsentry-release avatar Jun 20 '22 13:06 getsentry-release

Routing to @getsentry/team-web-sdk-frontend for triage. ⏲️

getsentry-release avatar Jun 20 '22 13:06 getsentry-release

Hi @yuval-sentry, could you specify which version of the CDN bundle you're using (are you on 7.x or still 6.x, are you using the es5 version)? I believe that the documentation is right in this case. We explicitly export BrowserTracing in addition to Integrations.BrowserTracing:

https://github.com/getsentry/sentry-javascript/blob/a20db222aff5919ec06ea07a94131946a9ee1ffa/packages/tracing/src/index.bundle.ts#L77-L82

So I'd be interested to investigate if there's a bug on the SDK side (in the CDN bundle). Thanks!

Lms24 avatar Jun 28 '22 13:06 Lms24

Hi Lukas,

I was loading it from here: src="https://browser.sentry-cdn.com/7.1.1/bundle.tracing.min.js" integrity= "sha384-p+vO3NBBhOw0sRTPPPeAacfOonwgsAL2xTEYl6sQIHhmQ17LLZkxHV2/s9VSEeTn"

On Tue, Jun 28, 2022 at 6:56 AM Lukas Stracke @.***> wrote:

Hi @yuval-sentry https://github.com/yuval-sentry, could you specify which version of the CDN bundle you're using? I believe that the documentation is right in this case. We explicitly export BrowserTracing in addition to Integrations.BrowserTracing:

https://github.com/getsentry/sentry-javascript/blob/a20db222aff5919ec06ea07a94131946a9ee1ffa/packages/tracing/src/index.bundle.ts#L77-L82

So I'd be interested to investigate if there's a bug on the SDK side (in the CDN bundle). Thanks!

— Reply to this email directly, view it on GitHub https://github.com/getsentry/sentry-docs/issues/5173#issuecomment-1168761045, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVKFUWSJ32H2OWWJELI4EIDVRMAA5ANCNFSM5ZDL5IMQ . You are receiving this because you were mentioned.Message ID: @.***>

yuval-sentry avatar Jun 28 '22 14:06 yuval-sentry

Hey Yuval, I tried reproducing this (set up a simple plain JS app with the CDN bundle from above) and for me, Sentry.Browsertracing seems to work. Can you tell me what didn't work exactly? Did you get an error?

Lms24 avatar Jul 01 '22 14:07 Lms24