I have a Google Cloud Function written in Go and deployed using Go 1.11 runtime, and it works. The problem arises when upgrading the runtime to Go 1.13, the same function and I get this error:
Error: could not handle the request
and in the logs of the Cloud Function I have these details of the error:
Function execution started
open ./progress.html: no such file or directory
Function execution took 232 ms, finished with status: 'connection error'
The file is there, in the same folder as the Go file.
Here is the relevant code of the function:
// Progress ... Entrypoint of our Cloud Function
func Progress(w http.ResponseWriter, r *http.Request) {
...
tpl, err := template.ParseFiles("progress.html")
if err != nil {
log.Fatalln(err)
}
buf := new(bytes.Buffer)
err = tpl.Execute(buf, data)
if err != nil {
log.Fatalln(err)
}
...
}
And if it helps, here is the repository of this function.
The only thing that changes is the Go runtime used for deploying it, from 1.11 to 1.13.
Here are the two commands used for deploying it:
It works:
gcloud functions deploy progress --runtime go111 --entry-point Progress --trigger-http --memory 128MB
It doesn't work (it deploys successfully, but the error appears when using the function):
gcloud functions deploy progress --runtime go113 --entry-point Progress --trigger-http --memory 128MB