Silverdagger
Silverdagger2w ago

Http Patch request body does appears to not get parsed into json correctly

I am trying to use a nextJS app written for node to be used with deno , and I encounted this issue. I showcase in the images bellow - basically a http patch endpoint in nextJS - receiving a request and then decoding it It always returns undefined in deno while it works as expected in node and bun Any suggestion as to what i could look into / change to fix it?
export async function PATCH(request: NextRequest) {
const user = await AuthenticateToken(request);

if (user === null) return new NextResponse("", { status: 401 });

const today = new Date();
// Parse balance message
const parsedBody = await request.json().catch(() => {
return new NextResponse("", { status: 400 });
});
const parsedZvalue = balanceSchema().safeParse(parsedBody.zvalue);

console.log("hmm?", parsedBody.zvalue);
...
export async function PATCH(request: NextRequest) {
const user = await AuthenticateToken(request);

if (user === null) return new NextResponse("", { status: 401 });

const today = new Date();
// Parse balance message
const parsedBody = await request.json().catch(() => {
return new NextResponse("", { status: 400 });
});
const parsedZvalue = balanceSchema().safeParse(parsedBody.zvalue);

console.log("hmm?", parsedBody.zvalue);
...
Images are of the same endpoint being called with the same input in Node - Bun - Deno
No description
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin