bugsnag/bugsnag-js

@bugsnag/plugin-vue is throwing: TypeError: Cannot read properties of undefined (reading 'errorHandler')

brunomonteiro-asknicely opened this issue · 4 comments

Describe the bug

The bugsnag-vue.js file is using Vue 2 syntax in a Vue 3 project due to a problematic if check. This then causes Bugsnag to try to access Vue.config in a Vue 3 project where global config is not available anymore.

This issue was also reported here, but it was closed due to lack of activity.

Problematic line seems to be this one. I believe a simple update to check Vue.version should fix it.

Steps to reproduce

  1. Install Vue 3 via package.json
  2. Import Vue 3 via CDN in the html file
  3. Follow the instructions to install Bugsnag in a Vue app

Environment

  • Bugsnag version: 7.23.0
  • Browser framework version (if any): Vue 3

Example Repo

Error messages:
TypeError: Cannot read properties of undefined (reading 'errorHandler')
    at _$vue2_3 (bugsnag-vue.js:82:1)
    at BugsnagPluginVue.load (bugsnag-vue.js:141:1)
    at Client._loadPlugin (bugsnag.js:1704:1)
    at eval (bugsnag.js:1592:1)
    at eval (bugsnag.js:338:1)
    at _$reduce_17 (bugsnag.js:7:1)
    at _$map_16 (bugsnag.js:337:1)
    at new Client (bugsnag.js:1591:1)
    at Object.createClient (bugsnag.js:3268:1)
    at Object.start (bugsnag.js:3285:1)

Just as an update: if I go to my node_modules folder and manually change the code to

if (this.Vue.version[0] === '2') {

it works fine!

Hi @brunomonteiro-asknicely

Thanks for sharing this workaround.

We now have an item on our backlog aimed at fixing this issue. While we don't have a clear ETA on the release of this functionality, we will be sure to update you once we have more information to share!

Thanks @clr182 ! Until this fix is released, we can't really use Bugsnag since the change in node_modules is not a realistic solution for our CI environment. Will keep an eye here and appreciate the update when that is done.

Hi @brunomonteiro-asknicely,

I just wanted to let you know that we have released v7.52.1 of bugsnag-js, which includes the fix for this in plugin-vue. Please do let us know if you have any further questions.