fix(vercel): add void return type and ctx param for Next.js 15 App Router compatibility#4878
Draft
AliiiBenn wants to merge 1 commit intohonojs:mainfrom
Draft
fix(vercel): add void return type and ctx param for Next.js 15 App Router compatibility#4878AliiiBenn wants to merge 1 commit intohonojs:mainfrom
AliiiBenn wants to merge 1 commit intohonojs:mainfrom
Conversation
…uter compatibility The handle() function now returns a function with a void return type and accepts an optional ctx parameter, which are required by Next.js 15 App Router route handler types. Co-Authored-By: martyy-code <nesalia.inc@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4878 +/- ##
=======================================
Coverage 92.89% 92.89%
=======================================
Files 177 177
Lines 11797 11799 +2
Branches 3515 3514 -1
=======================================
+ Hits 10959 10961 +2
Misses 837 837
Partials 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
handle()function inhono/verceladapter was incompatible with Next.js 15 App Router route handler types.Two type errors were reported:
Response | Promise<Response>but Next.js 15 expectsResponse | void | Promise<Response | void>ctxparameter that Next.js 15 passesFix
voidto the return type unionctx?: unknownparameter to match Next.js 15 expectationsThe runtime behavior is unchanged since
app.fetch(req)always returns a Response (via notFoundHandler if needed).Test plan
tsc --noEmitpasses in a Next.js 15 App Router project using the documented setup