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

🐛 BUG: Uncaught SyntaxError: Export 'ByteLengthQueuingStrategy' is not defined in module #1711

Closed
riderx opened this issue Feb 18, 2024 · 10 comments · Fixed by #1873
Closed
Labels
bug Something isn't working

Comments

@riderx
Copy link

riderx commented Feb 18, 2024

Which Cloudflare product(s) does this pertain to?

Workers Runtime

What version(s) of the tool(s) are you using?

3.28.1 [Wrangler] and tested with 3.28.3 [Wrangler]

What version of Node are you using?

20.11.1

What operating system and version are you using?

Mac Sonoma 14.2.1

Describe the Bug

Observed behavior

When using node:stream/web, there is a weird behavior where unrelated lib is said missing.

Expected behavior

No error

Steps to reproduce

Clone the repo and try to deploy.

Please provide a link to a minimal reproduction

https://github.com/Cap-go/wrangler_bug

Please provide any relevant error logs

CleanShot 2024-02-18 at 04 58 50@2x

@riderx riderx added the bug Something isn't working label Feb 18, 2024
@riderx
Copy link
Author

riderx commented Feb 18, 2024

same with dev command:
CleanShot 2024-02-18 at 05 03 54@2x

@jasnell
Copy link
Member

jasnell commented Mar 2, 2024

The ByteLengthQueuingStrategy implementation is a global. There's no need to try pulling it off node:stream/web. Is this your code or a library that you are using that is making use of ByteLengthQueuingStrategy?

@riderx
Copy link
Author

riderx commented Mar 5, 2024

It’s a library who use the import.
in node compat mode any nodejs import should be allowed even if it’s not required.
Otherwise importing any package who is made for nodejs will break randomly like that.
One solution could be to detect the wrong import at upload step and remove them before upload to cloudflare

@jasnell
Copy link
Member

jasnell commented Mar 5, 2024

If I may ask, which library is it? One off npm?

@riderx
Copy link
Author

riderx commented Mar 5, 2024

it was undici

@jasnell
Copy link
Member

jasnell commented Mar 5, 2024

Couple of things here.

We don't really have any intention of supporting the full range of node.js built-ins in workers. The plan has always been to support a subset that makes the most sense. We expect that there are always going to be gaps in what will work. Undici is one that I'm not sure will ever be fully supported in this environment, and it's not clear we should even try. Internally it makes use of a number of Node.js built-ins we do not intend to implement right now (e.g. node:net and node:os for instance).

That said, there's likely no harm in implementing support for the node:stream/web built-in but I wouldn't consider it a priority. We'd accept a PR for it tho if you're so motivated :-) ...

@riderx
Copy link
Author

riderx commented Mar 6, 2024

Thanks a lot for considering the request !

i would love to contribute and make this happen.

do there is a guide or a way to understand how i can make the PR ?

@jasnell
Copy link
Member

jasnell commented Mar 6, 2024

Wait! hmm... I went to go look to show you exactly where to make the change... and it's already there... it actually should be working. Are you enabling the nodejs_compat compatibility flag? I'll take a look tomorrow to see what may be going wrong.

@riderx
Copy link
Author

riderx commented Mar 6, 2024

I have provided a repository to demonstrate the problem here:
https://github.com/Cap-go/wrangler_bug
and yes the flag is enabled.
That also why I raised the issue because in cloudflare doc it says as well it’s supported

jasnell added a commit that referenced this issue Mar 21, 2024
@github-project-automation github-project-automation bot moved this from Untriaged to Done in workers-sdk Mar 21, 2024
@jasnell
Copy link
Member

jasnell commented Mar 21, 2024

This was closed automatically since #1873 was merged but the fix likely won't hit production or the updated workerd release until next week sometime.

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

Successfully merging a pull request may close this issue.

2 participants