Skip to content

Collecting page data ...TypeError: Cannot read property 'getInitialProps' of undefined #5978

@a-ursino

Description

@a-ursino

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/nextjs

SDK Version

7.15

Framework Version

No response

Link to Sentry event

No response

Steps to Reproduce

clone https://github.com/a-ursino/nextjs-sentry-bug
yarn
yarn build

Verify errors in the build output.

However if I don't import the content of the homepage from src/pages/Homepage and just inline it in pages/index.ts everything works fine.
If I disable sentry from next.config.js, I can still import the content from src/pages/Homepage and the build works fine.

NOTE:
I've created the example website with
npx create-next-app@latest
npx @sentry/wizard -i nextjs

Expected Result

build to succeed

Actual Result

info  - Linting and checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully
info  - Collecting page data ...TypeError: Cannot read property 'getInitialProps' of undefined
    at Object.355 (/Users/xyz/dev/-personal/my-app/.next/server/pages/index.js:180:41)

Metadata

Metadata

Assignees

Labels

Package: nextjsIssues related to the Sentry Nextjs SDK

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions