Uh oh!
There was an error while loading. Please reload this page.
fix(nuxt): Ignore 300-400 status codes on app errors in Nuxt - #15473
Conversation
GerryWilko
commented
Feb 25, 2025
@s1gr1d apologies for the call out but I'm not sure how to get this reviewed. You seem to be the resident Nuxt expert at Sentry looking at previous PRs? |
| if (isNuxtError(error)) { | ||
| // Do not report if status code is 3xx or 4xx | ||
| if (error.statusCode >= 300 && error.statusCode < 500) { |
There was a problem hiding this comment.
The 2 conditions could be ANDed.
s1gr1d
left a comment
There was a problem hiding this comment.
This looks good to me. At first I thought this might not make sense as this is a client-only plugin and we would need to create an explicit server plugin (for Nuxt, not Nitro).
Nitro runs only in the server folder, but Nuxt also runs on the server when it does e.g. SSR.
However, I tested this and it seems like the errors from the Nuxt server side are passed to the client and the hook is called on the client as well. So this change is fine.
This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #15473 Co-authored-by: s1gr1d <32902192+s1gr1d@users.noreply.github.com>
Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).Description
I noticed that Nuxt 300-400 status codes from the app are being reported to Sentry unnecessarily. There appears to be a guard against doing this on the server side errors but client side errors like 404 or 401s are being reported to Sentry.
I have simply added the same guard on the client side error reporter for the Nuxt integration of Sentry.