req.json() parses as [object ReadableStream]

trying to call a worker through service bindings with setupDevBindings, when parsing the body for some weird reason i'm getting back the serialization of the readablestream object
const response = await process.env.WORKER_QUEUE.fetch("http://localhost:8787", {
method: "POST",
body: JSON.stringify({
hello: "world",
}),
headers: {
"Content-Type": "application/json",
},
});
const response = await process.env.WORKER_QUEUE.fetch("http://localhost:8787", {
method: "POST",
body: JSON.stringify({
hello: "world",
}),
headers: {
"Content-Type": "application/json",
},
});
async fetch(req: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
const data = await req.json();
console.log(data);
return new Response('OK');
},
async fetch(req: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
const data = await req.json();
console.log(data);
return new Response('OK');
},
"wrangler": "^3.23.0" "@cloudflare/next-on-pages": "^1.8.5", "next": "14.0.3" WSL2
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server