Richard Pianka
Richard Pianka

Reputation: 1

Cloud Run returning 503 when streaming webm video

I'm trying to send a webm video stream over http from Cloud Run to a browser, but it consistently returns a 503 with the message Service Unavailable. Other requests return normally, so the service isn't actually unavailable. The response comes almost immediately, so it doesn't appear to be a timeout. The response headers don't carry over my content type (video/webm) but rather text/plain. The console logs spit out this error:

The request failed because either the HTTP response was malformed or connection to the instance had an error.

The server and client behave entirely correctly on localhost. I understand there's a 15 minute maximum on requests with Cloud Run. I also inferred based on this blog post from a few months ago that I'd be able to stream video:

Here are some example use cases for server-side HTTP streaming:

  • Streaming large files (such as videos) from your serverless applications
  • Long-running calculations that can report using a progress indicator
  • Batch jobs that can return intermediate or batched responses

I've tried other video container formats (e.g., flv) as well as setting the Content-Length to maximum (Long.MAX_VALUE) or not setting it at all. However, given it works locally and the error I see in the logs, I'm inclined to believe that Cloud Run (or some layer in between) is balking at the response itself rather than passing it through. Is there something I'm missing about what Cloud Run expects?

Upvotes: 0

Views: 250

Answers (1)

wlhee
wlhee

Reputation: 2604

Did you try using transfer-encoding: chunked ?

Upvotes: 0

Related Questions