sentry-javascript: Vue plugin prevents logging of errors to the console
Do you want to request a feature or report a bug?
A bug
What is the current behavior?
When Raven Vue plugin used, Vue will stop to log errors encountered during components rendering to the console
What is the expected behavior?
Expected Vue to log errors.
Raven version: 3.26.3 OS: Windows 10 Used via JSPM
This most likely happens because Raven.js defines Vue errorHandler, but starting from Vue 2.2.0 when it’s not undefined, Vue won’t log errors to the console. See errorHandler docs.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 17 (6 by maintainers)
Commits related to this issue
- Don't use Sentry in development We want to see Vue & JS errors in the local developer console rather than being silently rerouted to Sentry Related GitHub issues: - https://github.com/getsentry/sent... — committed to jac-uk/digital-platform by ollietreend 5 years ago
- Don't use Sentry in development We want to see Vue & JS errors in the local developer console rather than being silently rerouted to Sentry Related GitHub issues: - https://github.com/getsentry/sent... — committed to jac-uk/digital-platform by ollietreend 5 years ago
- Don't use Sentry in development We want to see Vue & JS errors in the local developer console rather than being silently rerouted to Sentry Related GitHub issues: - https://github.com/getsentry/sent... — committed to jac-uk/digital-platform by ollietreend 5 years ago
Agreed. This side-effect of integrating vue in sentry should really be documented… Personally spent a lot of time and frustration because of this.
Agreed -for users that is. however, suppressing errors for developers really just makes this whole thing super ironic. (Install sentry to catch issues you cannot see yourself on the clients; Ends up suppressing more issues)
I don’t agree with the sentiment that JavaScript console errors should be suppressed for end users.
When you’re casually browsing the internet and something doesn’t work, say you click on something and expect something to happen but it doesn’t, or you’ve placed an order and the success page takes longer than expected, how many of you developers check the JavaScript console? Im surprised if that’s not at least most web developers. It’s ironic that were the ones wanting to suppress errors for end users. It’s almost like killing logging for client side systems, sure probably the client will never look at the logs, but conceptually they should still exist on the client side.
Unless you are super paranoid about the inner workings of your app for whatever reason, I really don’t understand the necessity for changing the default behaviour of JavaScript.
@victor-ponamariov
https://docs.sentry.io/platforms/javascript/vue/
What I’d appreciate more is if you’d help us and fill a PR to either fix or document it 🙂
@BlitZz96 we have docs on the integration already - https://docs.sentry.io/platforms/javascript/#alternative-way-of-setting-an-integration 😃
You can also write it as:
I thought I could share my temporary workaround if it can be to help for others:
As @kamilogorek said:
Since we want the console output in development mode, we can simply add a condition based on the applications build-state and only use integration on production:
Is this something that could be useful in the docs @HazAT, or is it to spesific? 🤷♂️ 😄
*I assume most people here are using the vue cli or have a pre-made boilerplate - These most likely include build scripts with proper
NODE_ENVvariables. If not, simply addprocess.env.NODE_ENV = 'production'to your production build script in order to make this work.This actually worked for me
Yes indeed @kamilogorek! However, I was thinking more about the Vue docs. 😅 Maybe it could be useful for inexperienced developers to display a code-snippet along with the new warning you guys just added that shows how one can disable the integration while developing?
My apologies for not being more specific in the previous comment.
@ArmorDarks @erfanimani does the warning in the docs makes sense guys? https://github.com/getsentry/sentry-docs/pull/625
Yeap, I’ve actually missed the irony of the situation 😄
Current Vue integration code is available here. https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/pluggable/vue.ts
It contains this snippet (old plugin also had it):
Which means, that you can write:
And we’ll trigger an old behavior as well.