You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ asdf global nodejs 20.4.0
$ node blob.mjs
▶ blob
✖ stream (6.048208ms)
'Promise resolution is still pending but the event loop has already resolved'
▶ blob (6.810833ms)
ℹ tests 1
ℹ suites 1
ℹ pass 0
ℹ fail 0
ℹ cancelled 1
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 1.912083
✖ failing tests:
✖ stream (6.048208ms)
'Promise resolution is still pending but the event loop has already resolved'
✖ blob (6.810833ms)
'Promise resolution is still pending but the event loop has already resolved'
I encountered the problem when using Blob with helia:
import{describe,it}from"node:test";import{strictasassert}from"node:assert";import{createHelia}from"helia";import{unixfs}from"@helia/unixfs";describe("helia",async()=>{it("unixfs.addByteStream",async()=>{constnode=awaitcreateHelia();constnodefs=unixfs(node);constblob=newBlob(["Hello World!"],{type: "text/plain"});constcid=awaitnodefs.addByteStream(blob.stream());//never finished from nodejs>=20.4.0console.log(cid);awaitnode.stop();});});
Activity
bellbind commentedon Jul 25, 2023
This code is OK on node-v20.3.1-darwin-arm64.tar.gz, and failed on node-v20.4.0-darwin-arm64.tar.gz
other case:
$ asdf global nodejs 20.4.0 $ node blob.mjs ▶ blob ✖ stream (6.048208ms) 'Promise resolution is still pending but the event loop has already resolved' ▶ blob (6.810833ms) ℹ tests 1 ℹ suites 1 ℹ pass 0 ℹ fail 0 ℹ cancelled 1 ℹ skipped 0 ℹ todo 0 ℹ duration_ms 1.912083 ✖ failing tests: ✖ stream (6.048208ms) 'Promise resolution is still pending but the event loop has already resolved' ✖ blob (6.810833ms) 'Promise resolution is still pending but the event loop has already resolved'I encountered the problem when using Blob with helia:
From the blame list of lib/internal/blob.js, the bug spawned by the change of 8cc1438 .
This issue may be same as #48668
fix lib/internal/blob.js for nodejs#48668 nodejs#48916
lib: fix lib/internal/blob.js Blob.stream() for nodejs#48668 nodejs#4…
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
fix: revert workaround for bug in nodejs 20.5 (#905)
lib: fix to add resolve() before return at Blob.stream()'s source.pull()
fix: revert workaround for bug in nodejs 20.5 (#905)