Skip to content
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

[Next.js] Add digest property to error #3402

Open
kvlsrg opened this issue Mar 7, 2025 · 3 comments · May be fixed by #3407
Open

[Next.js] Add digest property to error #3402

kvlsrg opened this issue Mar 7, 2025 · 3 comments · May be fixed by #3407
Labels
enhancement New feature or request

Comments

@kvlsrg
Copy link

kvlsrg commented Mar 7, 2025

Currently there is no option to filter out NEXT_REDIRECT errors that are used by Next.js itself and are not useful for monitoring. Need to pass digest property of production React error to DataDog error object to filter out such errors in beforeSend.

@kvlsrg kvlsrg added the enhancement New feature or request label Mar 7, 2025
@BenoitZugmeyer
Copy link
Member

Hi, thank you for reaching out. I think you can already filter such error using beforeSend as you have access to the original error object in the context parameter:

beforeSend(event, context) {
  if (event.type === 'error' && context.error.digest) {
    return false
  }
  return true
}

Would that work?

@kvlsrg
Copy link
Author

kvlsrg commented Mar 7, 2025

Hello @BenoitZugmeyer

Unfortunately context.error is undefined in production mode. Here is console.log output for context from beforeSend:

Image

In dev mode everything ok, error object exist.

@kvlsrg
Copy link
Author

kvlsrg commented Mar 7, 2025

Seems this is a bug

@kvlsrg kvlsrg linked a pull request Mar 7, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants