question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to disable Sentry again at runtime?

See original GitHub issue

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Description

We allow to enable or disable error reporting in our browser extension (which is needed for GDPR). A browser extensions background script is long-running (doesn’t re-run at page reloads), so when error reporting is disabled, we need to disable Sentry after it was already enabled with Sentry.init(). I see there is Sentry.init({ enabled: false }) but it doesn’t look legal to call Sentry.init() twice. How can I disable Sentry after it was enabled before, at runtime?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

14reactions
felixfbeckercommented, Apr 29, 2019

As described in the issue description, we need to allow users to opt in and out of error reporting for privacy reasons. Anything that is unclear? Happy to provide more info but not sure what you are looking for

9reactions
kamilogorekcommented, Aug 8, 2019

In Raven I think you had shouldSendCallback to toggle reporting

Sentry.init({
  beforeSend(event) {
    if (shouldSendEvent) return event;
    return null;
  }
});

Any updates on providing the Sentry.setEnabled(boolean) to toggle error reports on/off?

What’s your use-case specifically? It’s already possible to conditionally drop and/or enable/disable sdk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disabling/re-enabling sentry at runtime (raven-js) - SDKs
Hi there. This is specific to raven-js usage. tl;dr: Is there any way to call Raven.config again and change some options for a...
Read more >
Dynamically enable and disable sentry without stopping ...
Is there a better way, am I missing something? You can call init(None) to disable the SDK, and then run your old init()...
Read more >
Sentry Mode - Tesla
Sentry Mode is Off when the icon is no longer red. Turn Sentry Mode Off in Controls > Safety > Sentry Mode to...
Read more >
Using the Dgraph Sentry Integration - Howto
Sentry is a powerful service that allows applications to send arbitrary events, messages, exceptions, bread-crumbs (logs) to your sentry account.
Read more >
Routing Alerts - Sentry Documentation
Alert notifications in Sentry can be routed to Slack, multiple supported ... Users can disable or enable all Project Alerts & Workflow Notifications...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found