0
votes

I am using serverless framework https://www.serverless.com/

I have created a http api gateway - https://www.serverless.com/framework/docs/providers/aws/events/http-api/

And enabled logging like so

provider:
  name: aws
  runtime: nodejs12.x
  logs:
    httpApi: true

Im looking for execution logs but im unable to see it in cloudwatch log groups.

From this documentation - https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/ it suggests execution logs are enabled by default when its a restApi: true but there is no mention of execution logs when you have a httpApi

2
Can you verify that the required IAM role has been created correctly? Also if you go to API gateway console, can you double check log settings?Marcin

2 Answers

2
votes

Execution logs are not available with HTTP APIs because they only support proxy integrations with Lambda and HTTP endpoint. So ideally there would be no transformation in request/response going in/out of API Gateway. Whatever request parameters client sends can be seen at the integration - so enable logging on Lambda/HTTP side to see the request details.

If you want to use access logs to troubleshoot errors for HTTP API, there is a new context variable $context.integrationErrorMessage that will give the error message in a similar format we see in execution logs for the traditional REST API.

1
votes

As of writing this HTTP API does not have support for Execution logs.

https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html