-
-
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
fix(nuxt): Ignore 300-400 status codes on app errors in Nuxt #15473
Conversation
@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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems very reasonable to me. @s1gr1d feel free to merge if this also makes sense to you!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 2 conditions could be ANDed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.