The Google Cloud Function's quota page: https://cloud.google.com/functions/quotas says that the Maximum amount of Data sent by HTTP Function in an HTTP Response is 10 MB. I have files of 100 MB in Google Storage Bucket which I want to stream from the Cloud Function to my application. Due to security aspects of our architecture, my application cannot read directly from the Storage Bucket.
A Sample Go Code in the Cloud Function is:
func MyFn(w http.ResponseWriter, r *http.Request) {
var appendedBytes []byte
for {
decryptedFileBuffer, err := fh.GetNextDecryptedPage()
if err != nil {
break
}
appendedBytes = append(appendedBytes, decryptedFileBuffer...)
}
w.Write(appendedBytes)
}
If I try to get files more than 10 MB using Cloud Function, I get following errors:
Error: incorrect function response. Function invocation was interrupted.
Error: could not handle the request
How can I get files from than 10 MB from the Cloud Function?