-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt/Vue: error 500 when exception captured #72696 #12515
Comments
Assigning to @getsentry/support for routing ⏲️ |
Hi @saint-james-fr, could you share a minimal reproduction of this error happening? Thanks! |
Hi @AbhiPrasad, here it is: https://github.com/saint-james-fr/sentry-error Simple nuxt app created with Then I pinned the same versions of packages mentioned in my earlier post. And i've got the same result: |
@saint-james-fr This seems to work as intended. You are not handling the error so it leads to an error state. Sentry should still capture the error, but you have to code some fallback UI for these error states. I recommend taking a look at Nuxt's error handling docs. |
Hi @AbhiPrasad thanks for checking this out, I'll try this but without Sentry, it just logged an error in the console, it does not crash like this just so you know. |
it happened to my project too. when sentry is capturing errors and an error occurs, the application crashes completely. while without sentry the project continue to work normally |
My workaround to fix this issue. of course you need to copy the utils from
|
I lack context into how Nuxt works, but I assume you all followed https://www.lichter.io/articles/nuxt3-sentry-recipe as a guide? We're working on a proper Nuxt SDK here: #9095, that should make this experience a lot better. maybe @manniL do you have any context about why adding Sentry via |
have seen this based on TheAlexLichter/nuxt3-sentry-recipe#8 but had no time to investigate. Shouldn't happen with v7 though. |
I used your "index.ts (Module entry)" code, but I got an error of |
@Dylan0916 Are you using the latest version of the Nuxt SDK? (btw it is still in alpha, but we are always happy for feedback) The How does your setup look like? Feel free to open an issue regarding |
same here server/sentry.ts export default defineNitroPlugin((nitroApp) => {
const { public: { sentry } } = useRuntimeConfig()
if (!sentry.dsn) {
console.warn('Sentry DSN not set, skipping Sentry initialization')
return
}
// Initialize Sentry
Sentry.init({
dsn: sentry.dsn,
integrations: [nodeProfilingIntegration()],
tracesSampleRate: 1.0,
profilesSampleRate: 1.0
})
nitroApp.hooks.hook('request', (event) => {
event.context.$sentry = Sentry
})
nitroApp.hooks.hookOnce('close', async () => {
await Sentry.close(2000)
})
nitroApp.hooks.hook('error', (error) => {
Sentry.captureException(error)
})
}) pages/example.vue if (!data.value) {
throw new Error("Not found");
} sentry was not capture this error |
@suleyman are you using |
no, im using |
The cause of this issue lies in the initialization behavior of the client-side code of Nuxt and sentry/vue.
The workaround provided here seems to be functioning to suppress the behavior in step 2. |
@konkarin Good debugging! 🔎 This is what I found last week as well :) Nuxt is un-setting their own error handler after the page setup if it wasn't overwritten.
The Sentry SDK however should not re-use the Nuxt |
A PR closing this issue has just been released 🚀This issue was closed by PR #13748, which was included in the 8.32.0 release. |
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
Dependencies:
"@sentry/vue": "8.7.0"
"nuxt": "3.11.2"
"h3": "1.11.1",
...
This is my Nuxt/Vue config inside
plugins/sentry.ts
I run a single vue component
Expected Result
It should capture the error and don't crash the app.
Actual Result
The app crashed with a 500 error (even if it happens on front-end side only)
Product Area
Unknown
Link
No response
DSN
No response
Version
No response
The text was updated successfully, but these errors were encountered: