























Next.js 15.1 brings core upgrades, new APIs, and improvements to the developer experience. Key updates include:
after (stable): New API to execute code after a response has finished streaming.forbidden / unauthorized (experimental): New APIs to enable more granular authentication error handling.Upgrade today, or get started with:
Next.js 15.1 now fully supports React 19:
Since the Next.js 15 release, a significant addition to React 19 was “sibling pre-warming”.
For a comprehensive overview of React 19’s updates, please refer to the official React 19 blog post.
We’ve made improvements to error debugging in Next.js, ensuring you can quickly locate the source of issues, whether they appear in the terminal, browser, or attached debuggers. These enhancements apply to both Webpack and Turbopack (now stable with Next.js 15).
Errors are now easier to trace back to their origin through the improved use of source maps. We’ve implemented the ignoreList property of source maps, which allows Next.js to hide stack frames for external dependencies, making your application code the primary focus.
For slightly more accurate source mapping of method names, we suggest adopting Turbopack (now stable), which has improved handling and detection of source maps over Webpack.
For library authors: We recommend populating the
ignoreListproperty in sourcemaps when publishing your libraries, especially if they are configured as external (e.g. in theserverExternalPackagesconfig).
We’ve improved the logic for collapsing stack frames to highlight the most relevant parts of your code.
Ignored stack frames are also recognized by built-in browser profilers. This makes profiling your application easier, allowing you to pinpoint slow functions in your code without noise from external libraries.
When using the Edge runtime, errors are now displayed consistently across development environments, ensuring seamless debugging. Previously, logged errors would only include the message and not the stack.
Terminal Before:
Terminal After:
Error Overlay Before


Error Overlay After


These improvements make errors clearer and more intuitive, allowing you to focus your time building your application rather than debugging.
We’re also thrilled to announce the introduction of a redesigned UI for the error overlay, coming in upcoming releases.
after (stable)The after() API is now stable following its introduction in the first Next.js 15 RC.
after() provides a way to perform tasks such as logging, analytics, and other system synchronization after the response has finished streaming to the user, without blocking the primary response.
Since its introduction, we’ve stabilized after() and addressed feedback including:
after() interacted with other Next.js features.waitUntil() primitives to power after().cookies() and headers() in Server Actions and Route Handlers.Read more about the after API and how to leverage it in the documentation.
forbidden and unauthorized (experimental)Next.js 15.1 includes two experimental APIs, forbidden() and unauthorized(), based on community feedback.
We’d love your feedback — please try it in your development environments and share your thoughts in this discussion thread.
If you’re familiar with the App Router, you’ve likely used notFound() to trigger 404 behavior alongside the customizable not-found.tsx file. With version 15.1, we’re extending this approach to authorization errors:
• forbidden() triggers a 403 error with customizable UI via forbidden.tsx.
• unauthorized() triggers a 401 error with customizable UI via unauthorized.tsx.
Good to know: As with
notFound()errors, the status code will be200if the error is triggered after initial response headers have been sent. Learn more.
As this feature is still experimental, you’ll need to enable it in your next.config.ts file:
Note:
next.config.tssupport was introduced in Next.js 15. Learn more.
forbidden() and unauthorized()You can use forbidden() and unauthorized() in Server Actions, Server Components, Client Components, or Route Handlers. Here’s an example:
To customize the error pages, create the following files:
We'd like to thank Clerk for proposing this feature through a PR and assisting us in prototyping the API. Before we stabilize this feature in 15.2, we're planning on adding more capabilities and improvements to the APIs to support a wider range of use cases.
Read the documentation for the unauthorized and forbidden APIs for more details.
create-next-app (PR)legacy-js-api warning (PR)Next.js is the result of the combined work of over 3,000 individual developers. This release was brought to you by:
Huge thanks to @sokra, @molebox, @delbaoliveira, @eps1lon, @wbinnssmith, @JamBalaya56562, @hyungjikim, @adrian-faustino, @mottox2, @lubieowoce, @bgw, @mknichel, @wyattjoh, @huozhi, @kdy1, @mischnic, @ijjk, @icyJoseph, @acdlite, @unstubbable, @gaojude, @devjiwonchoi, @cena-ko, @lforst, @devpla, @samcx, @styfle, @ztanner, @Marukome0743, @timneutkens, @JeremieDoctrine, @ductnn, @karlhorky, @reynaldichernando, @chogyejin, @y-yagi, @philparzer, @alfawal, @Rhynden, @arlyon, @MJez29, @Goodosky, @themattmayfield, @tobySolutions, @kevinmitch14, @leerob, @emmanuelgautier, @mrhrifat, @lid0a, @boar-is, @nisabmohd, @PapatMayuri, @ovogmap, @Reflex2468, @LioRael, @betterthanhajin, @HerringtonDarkholme, @bpb54321, @ahmoin, @Kikobeats, @abdelrahmanAbouelkheir, @lumirlumir, @yeeed711, @petter, and @suu3 for helping!
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。