Skip to content

Next.js SSR unhandled errors are not logged #9152

Closed
@curiousercreative

Description

@curiousercreative

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.73.0

Framework Version

Next.js 13.5.3

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

  1. Install NextJS example, enter project dir and init git repo (seems to be required for sentry wizard)
    npx create-next-app@latest nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter"
    cd nextjs-blog/
    git init
  2. Install sentry
    npx @sentry/wizard@latest -i nextjs
  3. Modify the home page to make it SSR rather than SSG and throw an error server-side during page component render.
    export function getServerSideProps () {
      return {
        props: {
          a: 'b',
        }
      }
    }
    
    export default function Home() {
      if (typeof window === 'undefined') throw new Error('server-side error')
      else throw new Error('client-side error')
    
      return <div></div>
    }
    
  4. Build, start, and load page at http://localhost:3000
    npm run build && npm start

Expected Result

I expected at least the server-side error to be logged in Sentry. I wouldn't be surprised if both a server-side and client-side error were logged per page load.

Actual Result

No errors are logged in sentry

Metadata

Metadata

Assignees

Labels

Package: nextjsIssues related to the Sentry Nextjs SDK

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions