Sentry.Integrations is undefined in lazy loaded SDK

I’m lazy loading Sentry as shown in the docs: https://docs.sentry.io/platforms/javascript/?platform=browser#lazy-loading-sentry

After Sentry.onLoad() is called, I expect to be able to use the SDK as if I had imported it into my bundle, like so import * as Sentry from '@sentry/browser'. However, it appears that Sentry.Integrations is undefined once loaded. I’m trying to use Sentry.Integrations.InboundFilters, which to my understanding should come with the SDK.

Example

Sentry.onLoad(() => {
	Sentry.init({
		integrations: [
			// ERROR: Sentry.Integrations is undefined
			new Sentry.Integrations.InboundFilters({
				blacklistUrls: [/example.com/]
			}),
		]
	})
})

EDIT: I tried adding integrations as a callback, and I do see the InboundFilters integration in the callback args. Does that mean the integration does come with the SDK, but it’s accessible somewhere other than Sentry.Integrations?

Sentry.onLoad(() => {
	Sentry.init({
		integrations: integrations => {
			console.log(integrations)
			// integrations[0] is InboundFilter, 
            // how do I provide constructor options?
			return integrations
		},
	})
})
1 Like

Can you try two things:
Either do this, add data-lazy="no"

<script
  src="..."
  crossorigin="anonymous"
  data-lazy="no">
</script>

or first thing to call:

Sentry.forceLoad();

problem is the Integrations do not ship with the lazy loader, so in your special case if you want to change the options you would need to not lazy load the SDK.

Hello,

I have a same Q. Is this https://docs.sentry.io/platforms/javascript/install/lazy-load-sentry/
loads and the Performance browser tracing and if it needs more info by me to init script alike and how =

Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  release: "my-project-name@" + process.env.npm_package_version,
  integrations: [new Sentry.Integrations.BrowserTracing()],

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

Does integrations needed? I just want to add a release info to mine and nothing else. Will it auto cache the performances?

The above code errors with integration.

I just want the latest (every time) sdk issues and performance tracing with mine custom release info. If you could help I will be much thankful.

It will be supper if Docs mention this how to integration, couldn’t find it!
Take care.