Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can the 'next js-page extensions' be applied in @sentry/nextjs? #5876

Locked Answered by AbhiPrasad
frontend-changjin-choi asked this question in Q&A
Discussion options

Hello. My project is based on nextjs, and the pages/ directory structure is as follows.

sample
├ sample.page.tsx (page component)
├ sample.styles.ts (only css)
└ sample.util.ts (only function)
_app.page.tsx
_document.page.tsx

I am using the custom page extensions feature of nextjs.
https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions

// next.config.js
pageExtensions: ['page.tsx', 'page.ts'],

When I tried to build the project after adding sentry/nextjs through the wizard, the following error occurred.

> Build error occurred
TypeError: Cannot read property 'getInitialProps' of undefined

I followed the stack trace and found that there was a problem with the code in /.next/server/chunks.

var userPageModule = constants_sentry_wrapped_namespaceObject;
var pageComponent = userPageModule.default;
var origGetInitialProps = pageComponent.getInitialProps;

sample_styles_sentry_wrapped_namespaceObject had the following comments:

// NAMESPACE OBJECT: ./pages/sample/sample.styles.ts?__sentry_wrapped_

It looked like there was no getInitialProps because it wasn't a page component.

You must be logged in to vote

Opened as an issue in #5877

Replies: 1 comment

Comment options

Opened as an issue in #5877

You must be logged in to vote
0 replies
Answer selected by frontend-changjin-choi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /