js-ipfs
js-ipfs copied to clipboard
ipfs-http-client problem with node-fetch ERR_STREAM_PREMATURE_CLOSE
-
Version: [email protected]
-
Platform: OS X 12.1 (21C52)
Severity:
Medium
Description:
Just calling attention to error upstream in node-fetch.
https://github.com/node-fetch/node-fetch/issues/1219
I was attempting to call dag.resolve() on 10+ cids in parallel and getting
FetchError: Invalid response body while trying to fetch http://ipfs:5001/api/v0/dag/resolve?arg=bafyreigl6kd23hvnh35rfeuhwedsh2s7y77zpql522hums3ghtpd2nro44: Premature close
at PassThrough.<anonymous> (/app/node_modules/node-fetch/lib/index.js:216:52)
at PassThrough.emit (node:events:520:28)
at emitErrorNT (node:internal/streams/destroy:164:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
type: 'system',
errno: 'ERR_STREAM_PREMATURE_CLOSE',
code: 'ERR_STREAM_PREMATURE_CLOSE'
}
UPDATE: As a workaround, you can force resolution of updated node-fetch in package.json. Just add this
// package.json
"resolutions": {
"node-fetch": "^2.6.7"
},
Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:
- "Priority" labels will show how urgent this is for the team.
- "Status" labels will show if this is ready to be worked on, blocked, or in progress.
- "Need" labels will indicate if additional input or analysis is required.
Finally, remember to use https://discuss.ipfs.io if you just need general support.
this is still happening and i wonder how going back to v2 of node-fetch is good or smart? also how come that this is not a prior for the ipfs team?
js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.
Please feel to reopen with any comments before 2023-06-05. We will do a final pass on reopened issues afterward (see https://github.com/ipfs/js-ipfs/issues/4336).