Closed Thoralf-M closed 2 months ago
I see a lot of NUL bytes in there... Is that the problem? And perhaps the call to .text()
is cleaning those out? If you do .bytes()
, and then pass that to serde_json::from_slice()
, will you see the same problem?
Hello @seanmonstar, yes! serde_json::from_slice(&resp.bytes().await.map_err(|err| err.to_string())?).map_err(|err| err.to_string())?
also results in expected value at line 1 column 1
With a large JSON (maybe only single large strings inside needed?)
.json::<serde_json::Value>()
will fail withdecoding response body: expected value at line 1 column 1
with WASM in node.js v22. For other JSON responses it works perfectly fine. The response.bytes()
start with the following (probably relevant here, contains431 Request Header Fields Too Large
and413 Payload Too Large
), and afterwards the actual response.Calling
.text()
on the response works fine.Full output from index.js
To reproduce
Run
docker run --rm $(docker build -q .)
with these files:Dockerfile
Cargo.toml
src/lib.rs
index.js