Skip to content
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

cloudflare preset breaks unenv/fetch and node:http polyfills #364

Open
pi0 opened this issue Dec 3, 2024 · 3 comments
Open

cloudflare preset breaks unenv/fetch and node:http polyfills #364

pi0 opened this issue Dec 3, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@pi0
Copy link
Member

pi0 commented Dec 3, 2024

Environment

unenv v2 nightly with nodeless + cloudflare presets

Reproduction

https://github.com/unjs/unenv/blob/main/test/workerd/tests.mjs#L134

example usage

Describe the bug

A change in #363 causes node:http polyfill to use runtime native node:stream which is incompatible with unenv/fetch polyfills (which essentially breaks H3 v1 and Nitro v2 as soon as they use it anyhow, via upgrade or wrangler transpiling for node_compat_v2)

Additional context

This bug introduced as a hotfix for opennextjs/opennextjs-cloudflare#147 (usage in opennextjs)

This is solvable via #365 to support node:stream for node:http polyfill natively.

Logs

No response

@pi0 pi0 added the bug Something isn't working label Dec 3, 2024
@pi0 pi0 changed the title cloudflare preset breaks unenv/fetch and node:http behavior cloudflare preset breaks unenv/fetch and node:http polyfills Dec 3, 2024
@Tofandel
Copy link

Tofandel commented Dec 3, 2024

This is a similar issue to #328

@pi0
Copy link
Member Author

pi0 commented Dec 3, 2024

@Tofandel i think you might want to link it to #365. this issue is new and not specific to supporting Express via direct fetch.

@Tofandel
Copy link

Tofandel commented Dec 3, 2024

It's new but I think it breaks in the same way now, than it breaks with Express, because a mix of polyfill and native implementation causes prototype issues which don't have access to the underlying node internal symbols

So the fix for this issue could apply to both and be ported to the node preset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants