getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
7.88k stars 1.56k forks source link

Next.js package does not report server and some client errors #3869

Closed jsakas closed 2 years ago

jsakas commented 3 years ago

Package + Version

Description

I am finding that the Next.js plugin does not report server side errors and some client side errors.

Using create-next-app and @sentry/wizard I have set up the most basic project which is deployed to Vercel. You can find my source code here: https://github.com/jsakas/sentry-next-test

I have three routes:

Only the third example, throwing on button click, works as expected. However this is the most unlikely use case for us. We recently had a unhandled server side exception (in getServerSideProps) which caused our site to crash. This error was not reported by Sentry and our customers ended up notifying our support team of the issue.

Here is the test project: https://sentry.io/organizations/guesthouse/issues/?project=5893235

onurtemizkan commented 3 years ago

Hi @jsakas. At the moment; a custom _error page is needed to capture both cases you provided. Tested your project on Vercel with that, and can confirm all three cases are working on @sentry/nextjs: 6.11.0 and next: 11.0.1.

It doesn't seem to be mentioned in the docs, though. I'll open a PR to add a note about those workarounds.

jsakas commented 3 years ago

Hi @onurtemizkan thank you for looking at that. I updated our _error page based on the example provided and it works now.

I agree about the docs, I think it should be added possibly on this page: https://docs.sentry.io/platforms/javascript/guides/nextjs/

A high order component wrapper would be cool too to minimize set up.

github-actions[bot] commented 2 years ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀