import { NextResponse } from "next/server";
export async function POST(request: Request) {
const data = await request.json();
console.log(data);
return NextResponse.json({ foo: "boo" });
}
next version = "next": "13.4.2"
issue: encountered error while trying to retrieve data using await request.json()
error SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:6571:19)
at successSteps (node:internal/deps/undici/undici:6545:27)
at node:internal/deps/undici/undici:1211:60
at node:internal/process/task_queues:140:7
at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)