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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Streaming (1.0.0-beta.55) breaks Cloudflare Pages #3764

Closed
1 task done
nrgnrg opened this issue Jun 29, 2022 · 3 comments 路 Fixed by #3777
Closed
1 task done

馃悰 BUG: Streaming (1.0.0-beta.55) breaks Cloudflare Pages #3764

nrgnrg opened this issue Jun 29, 2022 · 3 comments 路 Fixed by #3777
Assignees
Labels
- P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)

Comments

@nrgnrg
Copy link
Contributor

nrgnrg commented Jun 29, 2022

What version of astro are you using?

1.0.0-beta.55

Are you using an SSR adapter? If so, which one?

Cloudflare

What package manager are you using?

pnpm

What operating system are you using?

mac

Describe the Bug

I'm super excited that streaming has landed in Astro, such a great feature!

Unfortunately Cloudflare Pages are currently stuck on a fairly old version of the workers runtime that doesn't support streams. There is as of right now no way to set the compatibility date or the flag to enable streams. I've asked about this again on the Cloudflare discord but the last update was "it's coming soon", which isn't a concrete timeframe.

What this means is that the Cloudflare adaptor, for now anyway, will only work with versions of Astro pre 1.0.0-beta.55.

I've tried the web-streams polyfill and buffering the response to a string in the Cloudflare adaptor but I think the issue lies in the fact that the Response constructor doesn't know what to do when passed a stream and just outputs [object ReadableStream].

I don't think this is a bug or an issue with Astro, more Cloudflare Pages itself, but I've raised the issue here because I think it should be documented on the Cloudflare adaptor which I'm happy to raise a PR to do, since it's now somewhat broken. Or on the off chance there is a way to workaround the streams changes that went into Astro core?

Link to Minimal Reproducible Example

n/a

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added this to Needs Triage in 馃悰 Bug Tracker Jun 29, 2022
@tony-sull tony-sull added - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) s2-medium needs discussion Issue needs to be discussed labels Jun 29, 2022
@natemoo-re
Copy link
Member

Notes from Triage Call

  • Cloudflare adapter might need to use the @astrojs/webapi polyfill. If that works, we're good!
  • If not, we might need to make our streaming support detection is properly working.
  • As a final option, we may need to build-in a flag for core to toggle streaming on/off.

@natemoo-re natemoo-re removed the needs discussion Issue needs to be discussed label Jun 29, 2022
@natemoo-re natemoo-re moved this from Needs Triage to Accepted in 馃悰 Bug Tracker Jun 29, 2022
@tony-sull
Copy link
Contributor

The webapi polyfill won't do the trick unfortunately - ReadableStream is defined in Cloudflare Page Functions but is stubbed in with a constructor that throws an error if you try to use it right now

I'm checking to see if there's anything we can use for feature detection, but it looks like we'll probably need to expose a flag to disable streaming

@matthewp
Copy link
Contributor

matthewp commented Jul 1, 2022

Can the adapter not just buffer the response and create a new one with the final HTML?

馃悰 Bug Tracker automation moved this from Accepted to Done Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants