TypeError: RequestInit: duplex option is required when sending a body.
Hey welcome to our community! What are you trying to do here, and what’s going wrong? From your post, I can’t help as there’s not enough information.
okay, I am trying to upload metadata to an image on ipfs and it kept on throwing this error at the ipfs.add function when i run the script.
try {
const result = await ipfs.add(metadata,{duplex: true})
console.log(result);
} catch (e) {
console.log(e)
}
This happen if you are using node >= 18 with ipfs-http-client
The solution is to install the latest (>= 9.0.14) ipfs-utils
along side ipfs-http-client
Because ipfs-http-client
come with an old version or ipfs-utils
, later version fixes this issue
Ref: TypeError: RequestInit: duplex option is required when sending a body. · Issue #249 · ipfs/js-ipfs-utils · GitHub