TypeError: Inter-TransformStream ReadableStream.pipeTo() is not implemented

I am trying to do something similar to this (1) to stream responses from my Pages functions API. This works well in my local development environment, but fails when deployed to Cloudflare with the above error in error log. Curiously, looking at Workers ReadableStream methods docs (2), it looks like the pipeTo method is implemented. Is Pages perhaps using older or different version of Workers before this method was implemented? I suspect this because I found this post (3) that links to this (4) that describes the similar problem. Is that right? If so, how soon should we expect Pages functions to support the missing method? If not, what am I doing wrong and how do I fix it? (1) https://github.com/craigsdennis/vanilla-chat-workers-ai/blob/b422dfae3d89c49c40c6e9ad32d259f9390d77fa/src/index.tsx#L145-L147 (2) https://developers.cloudflare.com/workers/runtime-apis/streams/readablestream/#methods (3) https://www.answeroverflow.com/m/1181702193573789817 (4) https://community.cloudflare.com/t/running-into-unimplemented-functionality/77343
curl --location 'https://api.cloudflare.com/client/v4/accounts/{my-account}/ai/run/@cf/mistral/mistral-7b-instruct-v0.1' \
--header 'Authorization: Bearer {mytoken}' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "write me a poem about a dog"
}'
curl --location 'https://api.cloudflare.com/client/v4/accounts/{my-account}/ai/run/@cf/mistral/mistral-7b-instruct-v0.1' \
--header 'Authorization: Bearer {mytoken}' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "write me a poem about a dog"
}'
Cloudflare Docs
ReadableStream · Cloudflare Workers docs
A ReadableStream is returned by the readable property inside TransformStream. On the Workers ecosystem, ReadableStream cannot be created directly …
GitHub
vanilla-chat-workers-ai/src/index.tsx at b422dfae3d89c49c40c6e9ad32...
Contribute to craigsdennis/vanilla-chat-workers-ai development by creating an account on GitHub.
1 Reply
..
..OP4mo ago
In case anyone stumbles upon this, I resolved this issue by adding this line to wrangler.toml:
compatibility_date = "2024-06-01"
compatibility_date = "2024-06-01"
I'm not sure what the minimum compatibility date is, but the default must be relatively old to not support the missing pipeTo method.
Want results from more Discord servers?
Add your server