@sentry/browser
@sentry/node
raven-js
raven-node
_(raven for node)_4.1.1
Try to integration Vue and @sentry/browser. All messages received on sentry.io are [undefined]
[undefined]
Have tried with and without the Vue integrations.
Any advice on where to look? or where to collect more debug?
鈹溾攢 @sentry/[email protected]
鈹溾攢 @sentry/[email protected]
鈹溾攢 @sentry/[email protected]
鈹溾攢 @sentry/[email protected]
鈹溾攢 @sentry/[email protected]
鈹溾攢 @sentry/[email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
鈹溾攢 [email protected]
```
import App from './App'
import Vue from 'vue'
import * as Sentry from '@sentry/browser'
Sentry.init({
dsn: process.env.SENTRY_DSN,
integrations: [new Sentry.Integrations.Vue({ Vue })],
ignoreErrors: [
'ReportingObserver [deprecation]'
],
ignoreUrls: [
/extensions\//i,
/^chrome:\/\//i,
/^chrome-extensions:\/\//i
],
beforeSend: (event) => {
// Check if it is an exception -> Show report dialog
event.exception && Sentry.showReportDialog()
return event
}
})
new Vue({
el: '#app',
store,
router,
components: { App },
template: '
})
Can you try to call init
after you initialized your Vue
app?
Or not passing it at all, but still calling init after new Vue
with just new Sentry.Integrations.Vue()
?!
Thanks for the response
Same behaviour when moving to the created hook
/* eslint-disable no-new */
new Vue({
el: '#app',
store,
router,
components: { App },
template: '<App/>',
created: function () {
if (process.env.SENTRY_DSN) {
Sentry.init({
dsn: process.env.SENTRY_DSN,
integrations: [new Sentry.Integrations.Vue()],
ignoreErrors: [
'ReportingObserver [deprecation]'
],
ignoreUrls: [
/extensions\//i,
/^chrome:\/\//i,
/^chrome-extensions:\/\//i
],
beforeSend: (event) => {
// Check if it is an exception -> Show report dialog
event.exception && Sentry.showReportDialog()
return event
}
})
}
}
})
Moving back to raven.js
import Raven from 'raven-js'
import RavenVue from 'raven-js/plugins/vue'
if (process.env.SENTRY_DSN) {
Raven.config(process.env.SENTRY_DSN).addPlugin(RavenVue, Vue).install()
}
new Vue(....
gives more detail on sentry.io
I will take a look what's going on, thanks for trying it out.
So I just tried it out here:
https://codesandbox.io/s/03mx928290
It works as expected, I do not get [undefined]
.
Open the console, and check for the event output.
Thanks, i will start working through the differences between your example and my setup
@HazAT thanks for your help
It looks like the issue was with unhandled promise rejections (vue-resource in this case)
This is what i came up with to get a reasonable message, treating vue-resource rejections as a special case
beforeSend: (event) => {
if (event.exception && event.exception.mechanism &&
event.exception.mechanism.type === 'onunhandledrejection') {
return null
}
return event
}
And added a window event listener
window.addEventListener('unhandledrejection', (err) => {
var reason = err.reason
if (err instanceof Error) {
Sentry.captureException(reason)
} else if (reason.constructor.name === 'Response') {
var error = new Error(
reason.statusText + ' ' + reason.status + ' @ ' + reason.url
)
error.name = 'ResponseError'
Sentry.withScope(scope => {
scope.setTag('url', reason.url)
scope.setTag('status', reason.status)
Sentry.captureException(error)
})
} else {
var unhandledError = new Error(err)
unhandledError.name = 'UnhandledRejection'
Sentry.captureException(unhandledError)
}
})
@mmcardle you can also achieve this without overriding global handlers
Sentry.init({
beforeSend(event, hint) {
// do your stuff here...
// hint.originalException is `err` that you'd get in your original `unhandledrejection`
}
})
or
Sentry.configureScope((scope) => {
scope.addEventProcessor((event, hint) => {
// do your stuff here...
})
})
Just had this issue with 4.0.6
Unfortunately rejecting a promise with Request
object instead of standard PromiseRejection
is not a common scenario and we cannot predict it.
The initially reported issue is resolved I guess, so let me close it. Feel free to ping me if this still needs to be reopened. Cheers!
Most helpful comment
@mmcardle you can also achieve this without overriding global handlers
or