-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Unable to read request body Next.js #26667
Comments
Encountered a similar error when trying to run this CopilotKit example.. |
Means deno doesn't yet support nextjs after all. |
That's not true. This is a recent change in latest Next.js version that uses a Other runtimes like We are working on a solution that we will roll out in a few days. |
Yup. nextjs thing. I saw this workaround from another project. Running fastify with nextjs. Works for me so far. fastify.all('*', {
// nextjs does its own POST body parsing, must run before fastify
onRequest: async (req, res, next) => {
res.hijack();
try {
await handle(req.raw, res.raw);
} catch (err) {
console.error('Error in', req.url, err);
res.statusCode = 500;
res.raw.end('Internal server error');
}
next();
},
handler: () => {},
}); |
Would you kindly explain how someone unfamiliar with fastify would implement this solution to solve the problem with next-auth? |
Hey everyone! 👋
When experimenting with Next.js and Deno 2.0, I stumbled upon a strange issue that I couldn't quite figure out…
I've created a small Next.js project with a basic route file. In this file, I added both
GET
andPOST
methods with dummy responses. Although theGET
endpoint works perfectly, when I send aPOST
request with a standard JSON body, I consistently receive an "Invalid JSON parsing error."The Request
Here's what the request looks like:
Code
My
app/api/users/route.tsx
looks as follows:Error
Executing this request leads to the following error:
Steps to reproduce
api/users/route.tsx
file.deno task dev
command.api/users
endpoint with the JSON body shown above.Versions
The issue only seems to appear when running the Next.js server through Deno; running it through Node.js works just fine.
Is there something I’m missing here, or could this be a potential bug within the Deno framework?
Thank you so much in advance!
The text was updated successfully, but these errors were encountered: