-
Notifications
You must be signed in to change notification settings - Fork 127
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
[🐛 Bug]: Type "NextApiRequest" is not a valid type for the function's first argument. #565
Comments
To add, I have also tried:
Same result:
|
You're trying to use the old Node.js format instead of the Edge runtime format. Further, neither of those types are used in the app directory yet you wrote an example for a route handler. https://nextjs.org/docs/pages/building-your-application/routing/api-routes#edge-api-routes export const GET = (req: Request) => {
// do stuff
return new Response('hello world');
} |
Right, so it's not possible to use NextApiRequest or NextApiResponse as mentioned. Thanks. |
Still getting this type of error in next 14 (App Router) Type "NextApiRequest" is not a valid type for the function's first argument. Here is my code please let me know what is wrong on below code
|
Change |
next-on-pages environment related information
Description
Attempting to use the NextJS Api Routes handler as per their docs:
Will fail to build with the following:
This makes me believe that these types are not (yet) supported on CF Pages.
Please confirm, or please advise how to do this.
Reproduction
Try to create API Routes as per the documentation: https://nextjs.org/docs/pages/building-your-application/routing/api-routes
Pages Deployment Method
Pages CI (GitHub/GitLab integration)
Pages Deployment ID
f1f87320-335f-422a-ac67-7e81fd494a95
Additional Information
I have struggled for quite a while to test different scenarios using NextApiRequest and NextApiResponse, all my attempts failed. It would be beneficial to list the unsupported functions if possible to avoid developers having to test out each scenario.
Would you like to help?
The text was updated successfully, but these errors were encountered: