Sean Clark Hess
Sean Clark Hess

Reputation: 16079

How to get ECR container logs from AWS Lambda with a custom runtime

I finally got a lambda function working using a custom runtime on ECR. It's intended to be accessed via the HTTP Api. But the requests are failing with Internal Server Error. The logs give me the following error:

"Error":"Runtime exited with error":
exit status 1. 
Check your Lambda function code and try again

But I don't know why it exited. How can I see the stderr output of my container?

Here is the output of my log event

{
  "requestTime":"23/Jul/2021:14:31:45 +0000",
  "requestId":"...",
  "apiId":"...",
  "resourcePath":"$default",
  "path":"/ballot",
  "httpMethod":"GET",
  "stage":"$default",
  "status":"500",
  "integrationStatus":"200",
  "integrationLatency":"25",
  "responseLatency":"27",
  "responseLength":"35",
  "errorMessage":"Internal Server Error",
  "format":"SLS_HTTP_API_LOG",
  "version":"1.0.0",
  "integrationErrorMessage":"The Lambda function returned the following error":"RequestId":"4199ecbe-8ef2-4c5c-8d4b-37f29742662d Error":"Runtime exited with error":exit status 1. Check your Lambda function code and try again.,
  "responseType":"INTEGRATION_FAILURE"
}

Upvotes: 0

Views: 653

Answers (1)

Sean Clark Hess
Sean Clark Hess

Reputation: 16079

There are two log streams. One is for the http-api and contains the above message. The other is for the lambda and has the output. In my case they were named

    /aws/http-api/finalfive-dev Never expire    -   -   1 subscription

    /aws/lambda/FinalFive       Never expire    -

The second one contained the information I was looking for.

Upvotes: 1

Related Questions