Customise paramters in sentry lazy-loading

I was trying to implement Sentry lazy-loading in a project I’m working on. But we have some custom configuration we want to do dynamically for every environment and every deployment on them, environment, release, beforeSend are the parameters we supply to the init function.

But since the loader.js makes the init call for us I wasn’t exactly sure how to supply those parameters to the loader. I couldn’t find it in any of the Sentry’s documentation.

I found a similar issue being discussed here: How to update environment after initial init · Issue #1639 · getsentry/sentry-javascript · GitHub

I tried to place this logic from the thread inside Sentry.onLoad method but it was not working.

Sentry.configureScope(function (scope) { scope.addEventProcessor(function (event) { event.environment = 'something'; return event; }); });

Instead of setting the environment to the custom supplied the loader kept initiating Sentry with ‘production’ environment.

We want to custom supply environment, release and beforeSend parameters just like how it’s possible in init method call but also want the lazy loading feature of the loader. How can we do it?