Raven is not defined

Hi,

I am trying to integrate Sentry in the project but facing issues. This app is a Rails application with a VueJS SPA. Reading through the documentation here: /clients/javascript/integrations/vue/, I went ahead with the installation and it seemed to work. I have the following in application.js

const appConfig = require('config').get(process.env.NODE_ENV)

import Vue from 'vue'
import Raven from 'raven-js'
import RavenVue from 'raven-js/plugins/vue'

Raven
    .config(`https://${appConfig.sentry.key}@sentry.io/${appConfig.sentry.project}`)
    .addPlugin(RavenVue, Vue)
    .install()
console.log('Raven: ' + Raven.isSetup())

This prints 'Raven: true' on application load, which I presume that the installation process has been successful.

However, It didn’t start reporting exceptions for which I tried to manually capture them via:

store/actions.js

async getSomeData ({ commit }) {
    try {
        const { data } = await Axios.get(<some URL>);
    } catch (error) {
        // do something with the error
        Raven.captureException(error)
    }
}

I tried by supplying an URL which will 404 to test the capture of the error. However, this throws up Raven is not defined error:

Couldn’t find anything interesting here: https://github.com/getsentry/raven-js/issues?utf8=✓&q=is%3Aissue%20Raven%20is%20undefined

Also, don’t know what the resolution is here: https://stackoverflow.com/questions/42192182/vuejs-2-does-not-report-any-errors-sentry-io

package.json

"raven-js": "^3.17.0",

I’m having the same problem. How do I get Raven to all of my components of my app?

I ended up creating a mixin and creating a ravenCaptureException() function.

I faced same issue, and finally ended up with setting raven as global variable
Vue.prototype.$raven = Raven;
Then use it in components: this.$raven.captureException(‘Bla bla’);