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

Miniflare supports more TransformStream functionality than Workers #168

Closed
leviwolfe opened this issue Feb 1, 2022 · 4 comments
Closed
Labels
behaviour mismatch Different behaviour to Workers runtime
Milestone

Comments

@leviwolfe
Copy link

Miniflare supports passing the transformer argument to the TransformStream constructor. This worked for me and I could see chunks being passed to my transformer's transform method. Once I deployed this code to Cloudflare, the transform method is no longer called.

Cloudflare's Worker documentation for the TransformStream constructor makes no mention of the transformer argument. It only mentions:

The Workers platform currently only implements an identity transform stream, a type of transform stream which forwards all chunks written to its writable side to its readable side, without any changes.

It seems like Cloudflare is ignoring the transformer argument, so perhaps Miniflare should as well? It is a platform difference that cost quite a bit of time to debug.

leviwolfe added a commit to leviwolfe/miniflare-168 that referenced this issue Feb 1, 2022
@leviwolfe
Copy link
Author

I created a small repo at https://github.com/leviwolfe/miniflare-168 which I think reproduces this issue.

@mrbbot
Copy link
Contributor

mrbbot commented Feb 7, 2022

Hey! 👋 This is an issue with all the stream constructors (ReadableStream, WritableStream, TransformStream). Implementations of the ReadableStream and WritableStream constructors were added recently, but are currently behind a compatibility flag: https://community.cloudflare.com/t/2021-12-10-workers-runtime-release-notes/334982. We should probably change this to throw when the flag isn't set. 👍

@mrbbot mrbbot added the behaviour mismatch Different behaviour to Workers runtime label Feb 7, 2022
@leviwolfe
Copy link
Author

Thanks, I'll have to look into that flag! Funny enough the Cloudflare team said almost the exact same thing a few years back: https://community.cloudflare.com/t/running-into-unimplemented-functionality/77343/6

@mrbbot
Copy link
Contributor

mrbbot commented Jun 9, 2022

Hey again! 👋 The latest Workers Runtime adds a transformstream_enable_standard_constructor compatibility flag to enable the standard (Miniflare) behaviour. Will try implement the non-standard behaviour (also available as IdentityTransformStream) and that flag.

@mrbbot mrbbot added this to the 2.6.0 milestone Jun 9, 2022
@mrbbot mrbbot modified the milestones: 2.6.0, 2.7.0 Jul 9, 2022
@mrbbot mrbbot modified the milestones: 2.7.0, 2.8.0 Aug 19, 2022
@mrbbot mrbbot closed this as completed in 5ab7cb3 Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behaviour mismatch Different behaviour to Workers runtime
Projects
None yet
Development

No branches or pull requests

2 participants