Skip to content

Close sentry and init again #11093

Answered by AbhiPrasad
iNeoO asked this question in Q&A
Discussion options

You must be logged in to vote

What might be better here is to use enabled option.

Hey you can call Sentry.init with enabled: false to start (which disables the SDK).

Sentry.init({
  app,
  dsn: '__MY_DSN__',
  enabled: false,
});

Then later on you can re-enable the SDK whenever

const client = Sentry.getClient();
if (client) {
  // enable SDK to start sending events again.
  client.getOptions().enabled = true;
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by iNeoO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants