Hello all,
I'm trying to have a streaming response on Google Cloud Run with the Fastapi StramingResponse class.
This is the endpoint that takes around 5-15 seconds to execute.
from fastapi.responses import StreamingResponse
@app.get("/places/{place_id}/all-stream")
async def get_all_stream(place_id: str):
return StreamingResponse(getAllStream(place_id), media_type="text/event-stream")
Hi @tommyiaqmenumal,
Welcome to the Google Cloud community!
This is common when using HTTP/2, which is the default on Cloud Run because Google Cloud Run buffers the response before sending it.
Here are the workarounds based on Google Cloud Documentation:
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.
Thanks for your answer: