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 500 Error logs in development but not in Vercel deploy #8155

Closed
3 tasks done
TrentHurlbut opened this issue May 17, 2023 · 11 comments
Closed
3 tasks done

Next.js 500 Error logs in development but not in Vercel deploy #8155

TrentHurlbut opened this issue May 17, 2023 · 11 comments
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug

Comments

@TrentHurlbut
Copy link

TrentHurlbut commented May 17, 2023

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

7.52.1

Framework Version

Next 13.2.3

Link to Sentry event

https://repvue.sentry.io/issues/4189882115/?query=is%3Aunresolved&referrer=issue-stream&stream_index=0

SDK Setup

sentry.client.config.js

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,

  // Adjust this value in production, or use tracesSampler for greater control
  tracesSampleRate: 1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: true,

  replaysOnErrorSampleRate: 1.0,

  // This sets the sample rate to be 10%. You may want this to be 100% while
  // in development and sample at a lower rate in production
  replaysSessionSampleRate: 0.1,

  // You can remove this option if you're not planning to use the Sentry Session Replay feature:
  integrations: [
    new Sentry.Replay({
      // Additional Replay configuration goes in here, for example:
      maskAllText: true,
      blockAllMedia: true,
    }),
  ],
});

sentry.edge.config.js

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,

  // Adjust this value in production, or use tracesSampler for greater control
  tracesSampleRate: 1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: false,
});

sentry.server.config.js

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,

  // Adjust this value in production, or use tracesSampler for greater control
  tracesSampleRate: 1,

  // Setting this option to true will print useful information to the console while you're setting up Sentry.
  debug: true,
});

Steps to Reproduce

  1. Set up a Next.js project to handle error notifications for app in Sentry and connect to local development environment.
  2. Add Vercel integration for deployed project of same app.
  3. Test sample errors in development and deployment; both show up as issues in connected Sentry project.
  4. Test a 500 SSR error in development. This logs in Sentry project issues.
  5. Test same 500 SSR error in Vercel deployment. This does not log in Sentry project.

Expected Result

Both development and deployment log the same 500 SSR error in Sentry project issues.

Actual Result

Hello again :)

Actual result is the 500 SSR error only logs in development and not in the Vercel deploy. I have provided a link to the specific issue.

Here are the only logged errors we are seeing in Vercel associated with the event:

Data
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RewriteFrames
Sentry Logger [log]: SDK successfully initialized
TypeError: Cannot read properties of undefined (reading 'length')
    at PerformanceCategoryRating (/var/task/.next/server/pages/companies/[slug].js:1914:20)
    at Wc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at bd (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
TypeError: Cannot read properties of undefined (reading 'length')
    at PerformanceCategoryRating (/var/task/.next/server/pages/companies/[slug].js:1914:20)
    at Wc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at bd (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89) {
  page: '/en/companies/GlobalPayments'
}
RequestId: 6d3accfb-377d-4a7d-889b-82f86704ea9b Error: Runtime exited with error: exit status 1
Runtime.ExitError

and

…ion installed: Console
Sentry Logger [log]: Integration installed: Http
Sentry Logger [log]: Integration installed: Undici
Sentry Logger [log]: Integration installed: OnUncaughtException
Sentry Logger [log]: Integration installed: OnUnhandledRejection
Sentry Logger [log]: Integration installed: ContextLines
Sentry Logger [log]: Integration installed: LocalVariables
Sentry Logger [log]: Integration installed: Context
Sentry Logger [log]: Integration installed: Modules
Sentry Logger [log]: Integration installed: RequestData
Sentry Logger [log]: Integration installed: LinkedErrors
Sentry Logger [log]: Integration installed: RewriteFrames
Sentry Logger [log]: SDK successfully initialized
TypeError: Cannot read properties of undefined (reading 'length')
    at PerformanceCategoryRating (/var/task/.next/server/pages/companies/[slug].js:1914:20)
    at Wc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at bd (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
TypeError: Cannot read properties of undefined (reading 'length')
    at PerformanceCategoryRating (/var/task/.next/server/pages/companies/[slug].js:1914:20)
    at Wc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:68:44)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:70:253)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at bd (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:77:404)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:217)
    at $c (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:78:98)
    at Zc (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:71:145)
    at Z (/var/task/node_modules/react-dom/cjs/react-dom-server.browser.production.min.js:76:89) {
  page: '/en/companies/GlobalPayments'
}
RequestId: 2728ad40-eab0-4879-837e-7b1d44f8408b Error: Runtime exited with error: exit status 1
Runtime.ExitError

I'm not sure they have anything to do with Sentry, however. Just communicating that an error is happening on the server. There are no other logs related to Sentry or this event. It is almost like it's being ignored.

Is this at all related to this issue?
#6120

@lforst lforst added Package: nextjs Issues related to the Sentry Nextjs SDK and removed Status: Untriaged labels May 18, 2023
@lforst
Copy link
Member

lforst commented May 18, 2023

Hm, looks like this is a duplicate of #7602.

@TrentHurlbut
Copy link
Author

I think you're right. Still no solve then?

@lforst
Copy link
Member

lforst commented May 19, 2023

Gotta look into this. I am like 99.999% sure this worked at some point. Maybe vercel changed something or we have a regression.

Just to confirm: This happens when throwing in a basic server component right? Do you use the edge runtime?

@TrentHurlbut
Copy link
Author

Yes to both.

Thank you for digging into this!

@avnerI
Copy link

avnerI commented May 23, 2023

I'm joining the wait too

@github-actions
Copy link
Contributor

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 🥀

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2023
@lforst lforst reopened this Jun 21, 2023
@AbhiPrasad
Copy link
Member

Closing this issue for cleanup. Please re-open if this still applies. Thanks!

@AbhiPrasad AbhiPrasad closed this as not planned Won't fix, can't repro, duplicate, stale Jul 27, 2023
@lforst lforst reopened this Jul 31, 2023
@lforst lforst closed this as completed Sep 28, 2023
@TrentHurlbut
Copy link
Author

@lforst Was there a resolution to this? We had a bug live on our app for three weeks uncaught because of this gap in Sentry's coverage.

@lforst
Copy link
Member

lforst commented Sep 28, 2023

There are several reasons why I closed this:

  • I asked a question which wasn't answered. Making it unnecessarily hard for me to debug this.
  • We had several improvements to the SDK since this issue was opened, some of which likely resolved this.
  • It's 3 months since stale bot staled this issue and 2 months since Abhi pinged everybody here again before closing.
  • We don't see anybody else running into this issue.

It's unlucky that the SDK wasn't reporting the error for you but there is no guarantee that the SDK will catch everything. It's also just code after all.

Since a lot of time has passed I recommend updating Next.js and our SDK and report back whether the problem still exists.

@TrentHurlbut
Copy link
Author

TrentHurlbut commented Sep 28, 2023

Which question did you ask that wasn't answered? Also, there was somebody else that was running into this issue (@avnerI).

@lforst
Copy link
Member

lforst commented Sep 29, 2023

@TrentHurlbut My apologies! I missed the "Yes to both".

As for this issue, I unfortunately cannot reproduce it. I am getting errors in Sentry when I throw in an app deployed to Vercel. Would you mind sharing what the error was about that wasn't reported to Sentry?

One thing I can say: If there are any errors happening outside of any handlers, meaning in the global scope, outside of any api routes or server components, these errors will likely not be caught by Sentry. This is a limitation of AWS lambdas which Vercel uses, since they instantly freeze when a request is ended and there is "no time" for Sentry to flush events :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants