You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The task outputs an error info Generating static pages (0/3)TypeError:.
The build passes.
Note: I intentionally added an error in the code to make this bug testable.
Describe the Bug
The build passes instead of exiting.
Expected Behavior
When a Next.js app is built, errors should prevent the task to finalize the build and exit the process.
It's important to note that removing the <Suspense> boundary makes the build process to crash. Also, it seems to required a _app.tsx file, I first tried to use <Suspense /> inside the pages/index.tsx file but the bug wasn't reproducible.
Intentional code error
As mentioned previously, the code is intentionally not working in order to demonstrate my issue.
To fully describe my use case, imagine that title variable is an array coming from an external source (CMS, API etc.). If the value is changed to a string (or whatever other type), the page generation (or revalidation) should crash and not pass (which isn't currently the case).
Personal understanding
I may be wrong about the use of Suspense in this context.
Is it normal that the build process passes?
Should it be used with App Router and React Server Component only to avoid this?
ISR
A last note/question on revalidation and ISR, from the documentation, I'm seeing this:
When a request is made to a page that was pre-rendered at build time, it will initially show the cached page.
Any requests to the page after the initial request and before 10 seconds are also cached and instantaneous.
After the 10-second window, the next request will still show the cached (stale) page
Next.js triggers a regeneration of the page in the background.
Once the page generates successfully, Next.js will invalidate the cache and show the updated page. If the background regeneration fails, the old page would still be unaltered.
From a previous experience, I've faced an issue where a field value has changed (let's say from an array to a string) between the build and the revalidation and made the whole app to crash. While the first build was well working, Next.js still promoted to front-end a broken revalidated version of the page.
My question here may sound a bit off topic but is it the expected behavior of Next.js? Or is it related to this build-not-exiting issue?
Because from what I see on the documentation (Error handling and revalidation):
If there is an error inside getStaticProps when handling background regeneration
Does "background regeneration failing" only mention errors happening inside getStaticProps or also includes render errors?
Note: If you prefer me to discuss that second topic on a discussion, I can split this into two parts, it just feels connected to me.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale due to two years of inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.
This issue has been automatically closed due to two years of inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!
Verify canary release
Provide environment information
Operating System: Platform: linux Arch: x64 Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023 Binaries: Node: 18.12.0 npm: 9.7.1 Yarn: 1.22.19 pnpm: 8.6.8 Relevant Packages: next: 13.4.10-canary.8 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0 typescript: N/A Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
https://github.com/roch-numbered/next-build-with-suspense
To Reproduce
npm run build
.info Generating static pages (0/3)TypeError:
.Note: I intentionally added an error in the code to make this bug testable.
Describe the Bug
The build passes instead of exiting.
Expected Behavior
When a Next.js app is built, errors should prevent the task to finalize the build and exit the process.
It's important to note that removing the
<Suspense>
boundary makes the build process to crash. Also, it seems to required a_app.tsx
file, I first tried to use<Suspense />
inside thepages/index.tsx
file but the bug wasn't reproducible.Intentional code error
As mentioned previously, the code is intentionally not working in order to demonstrate my issue.
To fully describe my use case, imagine that
title
variable is an array coming from an external source (CMS, API etc.). If the value is changed to astring
(or whatever other type), the page generation (or revalidation) should crash and not pass (which isn't currently the case).Personal understanding
I may be wrong about the use of
Suspense
in this context.ISR
A last note/question on revalidation and ISR, from the documentation, I'm seeing this:
From a previous experience, I've faced an issue where a field value has changed (let's say from an array to a string) between the build and the revalidation and made the whole app to crash. While the first build was well working, Next.js still promoted to front-end a broken revalidated version of the page.
My question here may sound a bit off topic but is it the expected behavior of Next.js? Or is it related to this build-not-exiting issue?
Because from what I see on the documentation (Error handling and revalidation):
Does "background regeneration failing" only mention errors happening inside
getStaticProps
or also includes render errors?Note: If you prefer me to discuss that second topic on a discussion, I can split this into two parts, it just feels connected to me.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Vercel
The text was updated successfully, but these errors were encountered: