Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next.js 15: Type "FetchEventLike" is not a valid type for the function's second argument. #3548

Closed
devjmetivier opened this issue Oct 22, 2024 · 2 comments · Fixed by #3549
Closed
Labels

Comments

@devjmetivier
Copy link

What version of Hono are you using?

4.6.5

What runtime/platform is your app running on?

Node/Vercel

What steps can reproduce the bug?

Screenshot 2024-10-22 at 2 09 38 PM

☝️ The above error occurs when upgrading to Next.js 15. This, of course, uses hono/vercel's handler with the Route Handler convention. Example:

import { api } from '@repo/api/hono';

import { handle } from 'hono/vercel';

export const DELETE = handle(api);
export const GET = handle(api);
export const POST = handle(api);
export const OPTIONS = handle(api);

Like the error indicates, it has to do with the FetchEventLike type from Hono:

export const handle =
(app: Hono<any, any, any>) =>
(req: Request, requestContext: FetchEventLike): Response | Promise<Response> => {
return app.fetch(req, {}, requestContext as any)
}

I don't know if simply removing the requestContext argument along with its type is sufficient, but when I remove it locally and try to build all seems to work just fine. I don't see anything in the Route Handlers documentation that says it can't be removed, but I defer to the maintainers.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

I'm using this in a monorepo context, for clarity, but I don't think that's relevant for this specific error.

@yusukebe
Copy link
Member

Hi @devjmetivier

This is a bug. I'll fix it.

@AIEPhoenix
Copy link

@yusukebe Could you please release a new version soon? 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants