Skip to content

Custom pages/_error not rendered when exception in getInitialProps + custom _app + deployed to Vercel #27503

@wilsonpage

Description

@wilsonpage

What version of Next.js are you using?

11.0.1

What version of Node.js are you using?

14

What browser are you using?

Chrome

What operating system are you using?

Mac

How are you deploying your application?

Vercel

Describe the Bug

When the following are true Next fails to render the custom pages/_error:

  • Exception throw in MyPage.getInitialProps
  • Custom MyApp.getIntialProps is defined
  • App is deployed to Vercel

Expected Behavior

The error should be caught by Next and the custom pages/_error page should be rendered and passed props.err.

To Reproduce

Source: https://github.com/wilsonpage/nextjs-bug-get-initial-props-error-handling
Deploy: https://test-get-initial-props-error-wilsonpage.vercel.app/

  1. Deploy to Vercel (or use above deployment)
  2. Visit /?throwInGetInitialProps=1
  3. Observe custom pages/_error is not rendered. Instead we see Vercel default 500: INTERNAL_SERVER_ERROR screen.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Linking and NavigatingRelated to Next.js linking (e.g., <Link>) and navigation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions