Re-enable streaming on Cloudflare Pages #5914
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Originally, we disabled streaming on Cloudflare Pages because the Cloudflare Worker runtime didn't support ReadableStream (#3764, #3777). At the end of last year, the Worker Runtime was updated and now supports ReadableStream (Standards Compliant Workers API). So we can now remove the workarounds we had in place for Cloudflare.
Closes #5900.
Changes
Testing
I haven't added any tests - I couldn't see any examples of tests of streaming in other integrations.
I have deployed an example to Cloudflare Pages, available here: https://astro-streaming-cf.pages.dev/
The example is the basics example, except that the
<head>
meta tags have an await in them for ~2 seconds. You can see in the waterfall that we stream the first part and then wait for 2 seconds:Docs
This brings the Cloudflare Pages integration back to the expected and documented streaming behaviour when SSR is enabled.