Add integration after init


#1

I want to initialize sentry first thing on page load and only when I’m done loading vue.js and the rest of my scripts install vue integration.
Is it safe to use (new Sentry.Integrations.Vue()).install()?
Is there any other suggestion on how to do it?


#2

The proper way of doing this is to create a client on your own and bind it to the hub.

  // First Sentry init with dsn
  Sentry.init({dsn: 'DSN'});


  // After some time bind a new client with integration
  Sentry.getCurrentHub().bindClient(
    new Sentry.BrowserClient({
      dsn: "DSN",
      integrations: [new Sentry.Integrations.Vue()]
    })
  );

From that point onward all global functions will use the new bound client.


#3

But that kind of repeating it self.
I dont want to use the DSN againg.
Is there a nicer DRY solution?


#4

Sorry, there is no other way doing this.
Since we treat options as “immutable” which makes changing the DSN not possible, except you set a new Client.


#5

why can’t I just call the install later?


#6

There is no official public install anymore, only init and creating a new Client.