New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable sentry on dev environment when using angular plugin #436
Comments
@benvinegar seems legit for me, although I could imagine case where you'd want |
I had a similar request from @benvinegar and he pointed out that you can use:
And that will stop Raven from reporting. Switch the |
I did something similar to the above to allow install() to suceed, and to avoid making any http requests to actually send the errors (
This seems to be working fairly well, and still lets Raven run, but it simply doesn't report. I really dislike having to hack |
For others who stumble upon this If you are using webpack to build your application, you use environment variables to configure raven by using the environment plugin https://webpack.js.org/plugins/environment-plugin/ e.g.
|
isSetup is now read-only, so the above method no longer works. I found a following workaround, which seems to work, although I have no idea why.
It's still an awful solution because it hijacks all my errors so I don't know from which line they were thrown. At least I guess it's not as terrible as not seeing them at all. |
I have used this way. It seems working for me `if (environment.production) { and in providers Please let me know if I am doing anything wrong here. |
Looks fine to me. Apparently, original issue has been answered here already, so closing this one. Feel free to reopen if it's still relevant in any way. |
More easy at 'app.module.ts'
and
This way you have the localdev messages in your console (else Sentry grabs some) and at production you get the ones you want to have |
At least in Chrome (not sure about other browsers), another way to prevent Raven from "hijacking" the dev console is to blackbox https://gist.github.com/paulirish/c307a5a585ddbcc17242 |
And what about Sentry? I don't use Raven, i have Sentry and i want to disable it on development environment on my localhost. https://dev.to/angular/tracking-errors-in-angular-with-sentry-4oo0 — here it is |
@artuska you can either provide empty DSN or use Sentry.init({
dsn: process.env.development ? '' : 'your-real-dsn'
}) or Sentry.init({
dsn: 'your-real-dsn',
beforeSend(event) {
if (process.env.development) return null;
return event;
}
}) |
I dont think that actually disables Sentry. It just stops if from sending
data. Still the breadcrumbs wraps most issues which sucks
…On Mon, Dec 9, 2019 at 10:15 AM Kamil Ogórek ***@***.***> wrote:
@artuska <https://github.com/artuska> you can either provide empty DSN or
use beforeSend to halt the transport.
Sentry.init({
dsn: process.env.development ? '' : 'your-real-dsn'
})
or
Sentry.init({
dsn: 'your-real-dsn',
beforeSend(event) {
if (process.env.development) return null;
return event;
}
})
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#436?email_source=notifications&email_token=AAJVX45ZEIJWZSXZSBQ5ZQLQXYECDA5CNFSM4BW42VRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGIMY2Y#issuecomment-563137643>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJVX4YBWA3R6SM63NV5JPDQXYECDANCNFSM4BW42VRA>
.
|
@jimmykane correct, if you want to disable Sentry, just call |
At the moment it is not possible to disable the sentry plugin because the ngRaven module fails to load.
On the development environment I use the following without providing the DSN
Raven.config().install()
The callback that registers the raven provider is not called
Because the install function does not call the plugin that installs the module
isSetup() failed because the globalServer is null
The text was updated successfully, but these errors were encountered: