Open krotscheck opened 4 years ago
I confirm this annoying bug.
This bug is happening to me as well. Thank you for filing this issue @krotscheck and making this Google-able :)
Fixing it as such in our HTTP handler until this gets handled upstream:
func main() {
lambda.Start(handler)
}
func handler(ctx context.Context, req events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) {
// httpLambda is an instance of aws-lambda-go-api-proxy/httpadapter
resp, err := httpLambda.ProxyWithContext(ctx, req)
resp.Headers = nil
return resp, err
}
I've tagged v0.8.1
that includes this fix. I'll keep this issue open as we investigate with the API Gateway team.
So, here's a doozy bug that I encountered using the Gateway HTTP API (the new version) and the events returned from this proxy, that results in the duplication of headers. The process is this:
1. I attach a location header to my response
2. The following event is produced by the go-api-proxy
3. Duplicated headers received by the client
So far so good, right? Well, it turns out that the HTTP response that the client receives looks like this:
A bit more investigation, and I discovered that the HTTP API Gateway event translation merges the responses from both 'headers' and 'multiValueHeaders', creating the above multi-header response. Now, the multiple location headers are, strictly speaking, valid HTTP. However, according to the docs:
Workaround
The simplest workaround is to add an event interceptor in golang that deletes either of the two header blocks before returning it. Or, well, merge #73