As stated in the title, whenever I set my response header to be any status code besides the default (200), I receive a response error in my logs. This did not happen a few weeks ago so I am not sure why it is happening now. Another thread: Firebase Cloud Function finished with status: 'response error' said that the HTTP request of response of my function is higher than 10MB. However, I decided to just deploy a function (getTest) that is just
package foo
import (
"net/http"
)
func GetTest(w http.ResponseWriter, r *http.Request) {
// Status Code Test
w.WriteHeader(201) // Testing with status code 201
return
}
and I am still returned a 'response error'. Replacing any status code (201,400,404,500,etc.) for 200 in the above test code would result in a successful GCP log of status code 200.
Furthermore, GCP would sometimes automatically invoke the function again with a status 200 if the previous invocation ended in a response error as shown in photo #1. I say sometimes because I cannot consistently exhibit the issue. It is to my belief that during this re-invocation nothing in my code is actually executed and it just returns a 200.
Does anyone know the issue?
Edit: I also want to point out I only see this "response error" on Cloud Function Logs. On my API gateway logs, I see the correct status code the function ended on.
