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
[Cache Components] Allow hiding logs after abort (#84579)
When Next.js prerenders with Cache Components enabled it will abort
prerenders before they have completed. It is common for user code to log
in a catch block and with this new prerendering behavior these logs will
trigger frequently for cases where the rejection only happened because
we are abandoning the work. This is analagous to treating a fetch
rejection as an error even when you pass an abortSignal into the fetch
and then abort it.
Currently when logs occur after an aborted prerender we dim the log
output to signify that the log line is not particuarly important. This
is useful and for folks who want to see everything output by their
program this is potentially the best behavior. However many log
collectors don't support colors and have no way of contextualizing the
dimmed log which can lead to them appearing to be more significant than
they are.
To combat this we expose a new experimental flag that allows you to
completely disable logs after aborting. This means the log lines you see
are much higher signal.
The implementation is somewhat complex because we install the
environment extensions as early as possible before any user code can run
but we can't install the hiding behavior until we have a config in
scope. I've added the hiding installation to next-server and the worker
exportPages entrypoints. I believe this is sufficient to cover all
contexts in which we will prerender.
Copy file name to clipboardExpand all lines: packages/next/errors.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -871,5 +871,6 @@
871
871
"870": "refresh can only be called from within a Server Action. See more info here: https://nextjs.org/docs/app/api-reference/functions/refresh",
872
872
"871": "Image with src \"%s\" is using a query string which is not configured in images.localPatterns.\\nRead more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns",
873
873
"872": "updateTag can only be called from within a Server Action. To invalidate cache tags in Route Handlers or other contexts, use revalidateTag instead. See more info here: https://nextjs.org/docs/app/api-reference/functions/updateTag",
874
-
"873": "Invalid profile provided \"%s\" must be configured under cacheLife in next.config or be \"max\""
874
+
"873": "Invalid profile provided \"%s\" must be configured under cacheLife in next.config or be \"max\"",
875
+
"874": "Expected not to install Node.js global behaviors in the edge runtime."
0 commit comments