Open DenysMoro opened 1 year ago
Same error after upgrade Next.js from v13.4.19
to v13.5.2
and using a trpc backend :
function App({ Component, pageProps }: AppProps) {
return (
<>
<style jsx global>
{`
:root {
--lora-font: ${lora.style.fontFamily};
}
`}
</style>
<ThemeProvider attribute="class">
<UserProvider>
<Toaster />
<Component {...pageProps} />
</UserProvider>
</ThemeProvider>
<ReactQueryDevtools initialIsOpen={false} />
<Script
src={`https://maps.googleapis.com/maps/api/js?key=${process.env.NEXT_PUBLIC_GOOGLE_MAPS_API_KEY}&libraries=places&callback=Function.prototype`}
/>
</>
);
}
export default trpc.withTRPC(App);
Same here but without getInitialProps
in_app.tsx
but with initialProps related code in _error.tsx
:
Pages router and SSR only (ServerSideProps everywhere)
Error.getInitialProps = ({ res, err }: NextPageContext) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404
return { statusCode }
}
export default Error
npm run build
> ksb-website@1.0.0 build
> NODE_ENV=production next build
Skipping validation of types
Skipping linting
✓ Creating an optimized production build
✓ Compiled successfully
✓ Collecting page data
✓ Finalizing page optimization
Static worker unexpectedly exited with code: null and signal: SIGINT
Static worker unexpectedly exited with code: null and signal: SIGINT
Static worker unexpectedly exited with code: null and signal: SIGINT
Static worker unexpectedly exited with code: null and signal: SIGINT
Static worker unexpectedly exited with code: null and signal: SIGINT
Static worker unexpectedly exited with code: null and signal: SIGINT
Removing Error.getInitialProps
removes the error.
This is 100% from the docs: https://nextjs.org/docs/pages/building-your-application/routing/custom-error#more-advanced-error-page-customizing
Same here but without
getInitialProps
in_app.tsx
but with initialProps related code in_error.tsx
:Pages router and SSR only (ServerSideProps everywhere)
Error.getInitialProps = ({ res, err }: NextPageContext) => { const statusCode = res ? res.statusCode : err ? err.statusCode : 404 return { statusCode } } export default Error
npm run build > ksb-website@1.0.0 build > NODE_ENV=production next build Skipping validation of types Skipping linting ✓ Creating an optimized production build ✓ Compiled successfully ✓ Collecting page data ✓ Finalizing page optimization Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT
Removing
Error.getInitialProps
removes the error.This is 100% from the docs: https://nextjs.org/docs/pages/building-your-application/routing/custom-error#more-advanced-error-page-customizing
Good find. I'm also running this on a project that uses a custom getInitialProps
for Sentry error reporting as recommended by Next.js' example code and documentation
i have the same issue, seems to be introduced in 13.5, 13.4 seems to be working fine for me.
I am seeing this is 13.4.12, so not sure if 13.5 is the only culprit
Same error after upgrade Next.js from v13.4.19 to v13.5.2
I have also noticed how all the content of the <Head>
element used in a page is no longer in the static export. e.g.
yarn build && yarn next export && npx serve out
import Head from 'next/head'
import { Inter } from 'next/font/google'
import styles from '@/styles/Home.module.css'
const inter = Inter({ subsets: ['latin'] })
export default function Home() {
return (
<>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
Gone
If I do:
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 27c489b..b98b0c1 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
</>
)
}
+
+Home.getInitialProps = () => ({});
A reproduction:
yarn && yarn build && yarn next export && npx serve out
I have gone through a couple of versions. I have run the build with all the below versions. The first version that doesn't throw errors is 13.3.4. All version I have tried above 13.3.4 was throwing SIGINT or SIGTERM error on the build logs.
Version tried:
I want to share these results in case it can be helpful.
Referencing here, a comment with my findings: https://github.com/vercel/next.js/discussions/48192#discussioncomment-7310817
Same here but without
getInitialProps
in_app.tsx
but with initialProps related code in_error.tsx
: Pages router and SSR only (ServerSideProps everywhere)Error.getInitialProps = ({ res, err }: NextPageContext) => { const statusCode = res ? res.statusCode : err ? err.statusCode : 404 return { statusCode } } export default Error
npm run build > ksb-website@1.0.0 build > NODE_ENV=production next build Skipping validation of types Skipping linting ✓ Creating an optimized production build ✓ Compiled successfully ✓ Collecting page data ✓ Finalizing page optimization Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT
Removing
Error.getInitialProps
removes the error. This is 100% from the docs: https://nextjs.org/docs/pages/building-your-application/routing/custom-error#more-advanced-error-page-customizingGood find. I'm also running this on a project that uses a custom
getInitialProps
for Sentry error reporting as recommended by Next.js' example code and documentation
Did you solve it by removing CustomErrorComponent.getInitialProps
?
I have the same configuration in _error.tsx
from Sentry cli.
What did you do exactly?
Same here but without
getInitialProps
in_app.tsx
but with initialProps related code in_error.tsx
:Pages router and SSR only (ServerSideProps everywhere)
Error.getInitialProps = ({ res, err }: NextPageContext) => { const statusCode = res ? res.statusCode : err ? err.statusCode : 404 return { statusCode } } export default Error
npm run build > ksb-website@1.0.0 build > NODE_ENV=production next build Skipping validation of types Skipping linting ✓ Creating an optimized production build ✓ Compiled successfully ✓ Collecting page data ✓ Finalizing page optimization Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT
Removing
Error.getInitialProps
removes the error.This is 100% from the docs: https://nextjs.org/docs/pages/building-your-application/routing/custom-error#more-advanced-error-page-customizing
Same here but without
getInitialProps
in_app.tsx
but with initialProps related code in_error.tsx
:Pages router and SSR only (ServerSideProps everywhere)
Error.getInitialProps = ({ res, err }: NextPageContext) => { const statusCode = res ? res.statusCode : err ? err.statusCode : 404 return { statusCode } } export default Error
npm run build > ksb-website@1.0.0 build > NODE_ENV=production next build Skipping validation of types Skipping linting ✓ Creating an optimized production build ✓ Compiled successfully ✓ Collecting page data ✓ Finalizing page optimization Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT Static worker unexpectedly exited with code: null and signal: SIGINT
Removing
Error.getInitialProps
removes the error.This is 100% from the docs: https://nextjs.org/docs/pages/building-your-application/routing/custom-error#more-advanced-error-page-customizing
You've just removed Error. getInitialProps
, but did you add something to replace it?
Link to the code that reproduces this issue
https://github.com/ifier/next-js-SIGINT
To Reproduce
npm run build
If you will go to
_app
and comment outgetInitialProps
section fully - it will build with no errors.Current vs. Expected behavior
I would expect not to see this list
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
Not sure
Additional context
No response