TLDR: Is there a way to enable HTTP streaming on the Cloud Run service on GCP?
So React 18 supports streaming. I am using the Remix framework that should stream responses out of the box according to their documentation.
Sounds cool right? Unfortunately I’m into Google Cloud Platform and App Engine Standard. App Engine Standard wasn’t supporting it (and being honest about it in their docs).
I deployed a Remix application on App Engine and it didn’t seem to stream.
Here is a screenshot of the response headers of my Remix project running on App Engine (so that this post doesn’t lose information if I take the example offline).
App Engine Flex might support it (as it can also do stuff like Websockets where App Engine standard cannot), but App Engine Flex has the downside that it always needs 1 instance running. Which is not ideal for my hobby app, as it has very few users.
But I was reading about Cloud run and hoping that it was able to do HTTP streaming. I made a Dockerfile for a generated Remix project in a repo and deployed it to cloud run. Here is a screenshot:
Both these screenshots look way different from what the response headers look like when I run the Remix project locally:
As you can see there it says Connection: keep-alive and Transfer-Encoding: chunked
I did search the internet about cloud run and streaming but all I can find is this reddit post which says streaming might not work if you deploy in certain regions (but I deployed on the region in the Netherlands as I’m located there). Also I found this other SO question where it said it does grpc streaming but that’s not what I need.
Help is appreciated!
2
Answers
I made a streaming example that streams pokemon names in a very visible way (for like 15 seconds): https://github.com/Leejjon/remix-vite-with-streaming/
I deployed to:
Unfortunately the Cloud Run doesn’t support streaming features by
HTTP
request withoutgrpc
. There is already a Feature request that exists for the same on the Public issue Tracker(PIT) . Additionally, you can upvote the PIT, add your concerns there and cc’s yourself to get notification for further update on the PIT.The best way for you might be to use HTTP requests along with grpc or as another option you may explore GKE. I think GKE supports http streaming.