-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Closed
Description
Verify canary release
- I verified that the issue exists in Next.js canary release
Provide environment information
next: 12.1.1-12.1.6-canary.2
react: 17.0.2 or 18.0.0
node: 14.19.1
system: windows
What browser are you using? (if relevant)
chrome 100.0.4896.88
How are you deploying your application? (if relevant)
next start
Describe the Bug
Expected Behavior
no error in console and display page content
To Reproduce
//app.ts
const MyApp = ({ Component, pageProps }: AppProps) => {
return <Component {...pageProps} />;
};
MyApp.getInitialProps = async (appContext: AppContext) => {
const some = await fetch('....');
const appProps = await App.getInitialProps(appContext);
return { ...appProps, pageProps: { ...appProps.pageProps, some } };
};
export default MyApp;
//index.ts
export default function Home(){
return (
<div>some text</div>
)
}
export const getStaticProps: GetStaticProps = async () => {
return { props: { } };
}
Then npm run build, everything is ok and built successfully.
Now npm run start, get error like this in console (see image attached) and there is nothing displaying in browser, just blank:
A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred
Error rendering page: TypeError: Cannot read properties of undefined (reading 'getInitialProps')
No error if next 12.1.0 and more lower version.
wedelgaard, C-E-Rios, nemuvski, meotimdihia, mzruiz and 3 morewedelgaard, meotimdihia, regine-alta and sdoomz
Metadata
Metadata
Assignees
Labels
No labels
