JulianMar / nuxt-bugsnag

Bugsnag module for nuxt.js
MIT License
49 stars 18 forks source link

useBugsnag in `/server` api #53

Closed 5knnbdwm closed 1 year ago

5knnbdwm commented 1 year ago

Hey, as Nuxt doesnt autoimport composables into the /server folder. Is there any way for me to use useBugsnag() on the server? as there are some functionalities that are disconnected from the user frontend and i would still like to add reporting there.

I have tried useBugsnag() and this.$bugsnag but both of them fail with

useBugsnag is not defined

and

Cannot read properties of undefined (reading '$bugsnag')

Additionally there doesnt seem to the option to import the useBugsnag() composables into files that dont have the autoimport.

JulianMar commented 1 year ago

Hey, i noticed a strange behaviour. It works if you do a production build and run it but it doesn't work if you run it in dev mode. Can you try to replicate this in your case? Thank you

5knnbdwm commented 1 year ago

Okay yeah, in the production build it does work.

While that knowledge allows me to add checks for every useBugsnag server call does seem really annoying.

JulianMar commented 1 year ago

Okay good. You can reproduce it. I will definitely fix it, but just need some time to find the correct solutions. Maybe it needs to be fixed in the nuxt repo, but I need some more time.

JulianMar commented 1 year ago

Hey, it should be fixed with the new version :)