aws / aws/aws-sam-cli

Gzipped content cannot be returned from an API Gateway

Open
#3,004 7 comments 4 reactions 0 assignees View on GitHub
area/local/start-lambda maintainer/need-followup
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:
For local testing with lambdas behind an API Gateway, I cannot return gzipped content that is base64 encoded that API Gateway expects. Locally I can only return uncompressed API responses. The browser fails to decode the response from the local API Gateway.

Why this matters?
Cost, performance, aws limits for large responses.

What if I want gzipped content served from s3 or an API to return gzipped content?

If local responses are too large because they are uncompressed, they will be rejected even though they will work in AWS when compressed.

### Steps to reproduce:
Have any API Gateway response return a base64 encoded gziped response. The API Gateway response should indicate that the response is base64 encoded like API Gateway expects. Also ensure the Content-Encoding header is set to gzip.

### Observed result:
Base64 gziped content cannot be decoded by any browsers, but works when running in AWS.

### Expected result:
Local API Gateway returns a gzipped response.

### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

1. OS: MacOS
2. `sam --version`: 1.24.1
3. AWS region: us-east-1

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.