Closed h12w closed 7 years ago
It's hard to tell from just this error message, but is it possible that the Go function isn't writing a response to http.ResponseWriter
as in:
// Standard AWS λ function
func helloWorld(event *json.RawMessage,
context *sparta.LambdaContext,
w http.ResponseWriter,
logger *logrus.Logger) {
// Job logic
fmt.Fprint(w, "Job complete")
}
It seems to be related to a 10-seconds timeout in the Node.js wrapper, and can be reproduced with code below:
func helloWorld(event *json.RawMessage,
context *sparta.LambdaContext,
w http.ResponseWriter,
logger *logrus.Logger) {
for i := 0; i < 11; i++ {
w.Write([]byte(strconv.Itoa(i)))
logger.Infof("%d", i)
time.Sleep(time.Second)
}
}
BTW, writing something with ResponseWriter does not help.
Thanks for the details - investigating.
I cannot wait for the fix, so I have switched to eawsy/aws-lambda-go. It does not provide CloudWatch triggers but the deployment is a lot faster than Sparta.
Appreciate the update - I still would like to resolve this issue, but need some additional diagnostic information. If you do end up switching back to Sparta, please re-open.
I'm trying to run a CloudWatch cron job in Lambda, after the job is completed (I can tell from the log), the Lambda function fails with the error message below:
It seems an error from Node.js. Any ideas?