aws / aws/aws-sam-cli

SAM CLI should support the `X-Amz-Log-Type: Tail` header

Open
#2,900 2 comments 1 reaction 0 assignees View on GitHub
area/local/invoke maintainer/need-followup type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Describe your idea/feature/enhancement

It would be helpful for the SAM CLI to support the `X-Aws-Log-Type` header being set to `Tail` in Lambda invoke requests, so that locally hosted SAM functions could be invoked from other systems that set the header to that value. (See [Localstack](https://github.com/localstack/localstack/blob/d951cf457ddca31ba729a7d2c67cb4edac4fea43/localstack/services/awslambda/lambda_api.py#L938))

### Proposal

If this header is set to `Tail`, then SAM should return 4KB of the base64-encoded execution logs to the caller in the `LogResult` parameter of the response body.

This should be relatively straightforward to add to the [`LocalLambdaInvokeService._invoke_request_handler` method](https://github.com/aws/aws-sam-cli/blob/4543732bf3c0da3b57fe1e5aa43ce3f41d2bd0ba/samcli/local/lambda_service/local_lambda_invoke_service.py#L124), because the lambda_logs are in scope at the time that the response payload is constructed. (However, there definitely might be some nuance I am missing)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.