How to handle error when firebase HTTP request size is bigger than 10MB?

Hey I have an API endpoint hosted on firebase hosting + cloud functions. I'm aware that cloud functions won't start if the request size is bigger than 10mb, but is there any gracefull way to send the error message to client?

The default behaviour is google frontend server sends a plain text that says Error: could not handle the request, and also it takes almost 2 minutes to send the response back. screenshots of firebase response

Is it possible for me to redirect client to my own static error page and reduce the response time?

I've doing some searching but I have not found anything to handle this issue.

Thank you.

1 answer

  • answered 2020-10-16 04:43 Doug Stevenson

    No, this handling it outside of your immediate control. There is no code or configuration that can change the behavior.

    If you are concerned that the 10MB limit might be exceeded, your client code to check the size of the request before making the request, and your function should check the size of the response before sending it. If you need to exceed the limits, you should use Cloud Storage instead to store the payload, and arrange for the client and server to agree on file locations.