-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix + update examples #173
Conversation
|
commit: |
Use ReadableStream.from instead of Readable.toWeb The latter triggers a "This ReadableStream is disturbed" error See cloudflare/workerd#3245
There is a "[unenv] fs.readdirSync is not implemented yet!" error to investigate
Does not build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
init.body = __cf_stream.Readable.toWeb(init.body); | ||
} | ||
// https://github.com/cloudflare/workerd/issues/3245 | ||
body: init.body instanceof __cf_stream.Readable ? ReadableStream.from(init.body) : init.body, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this fail if init.body
is a Readable from unenv ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the top of my head I would say no.
It works with Node (/undici) only because a Readable is async iterable.
And we moved away from unenv Readable because it does not implement async iterator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about user code actually, since this is overriding the global Request
, user code or one of their lib could be using unenv or similar and instanceof
would be false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it now.
There should be no more instances of unenv Readable
after unjs/unenv#363 (cloudflare/workerd#3245 has some details). Before that it was still possible to create an unenv Readable via the http module.
See cloudflare/workerd#3245 for details/rationale about the fix.
Updated the examples.
The blog and commerce examples fails, I'll create separate issues for them.
-> See #174 and #175, both added to the board.