aws / aws/aws-lambda-go

Examples shouldn't suggest to return error objects

Open
#272 0 comments 3 reactions 0 assignees View on GitHub
documentation
Dominant language
Go
Stars
3.8k
Forks
578
Avg merge
8h 18m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**
Some code examples, in particular https://github.com/aws/aws-lambda-go/blob/master/events/README_ApiGatewayCustomAuthorizer.md , suggest returning an error object from lambda handlers. This leads to problems with AWS Lambda and API Gateway in most cases, because the error object is not processed correctly by AWS Lambda.

The result is an almost meaningless error 500 response on the Lambda invocation without any error indication. It doesn't make a difference if the Lambda function is called through API Gateway or directly.

**Describe the solution you'd like**
The examples should either suggest returning a meaningful error in the response itself, or document how to use `events.APIGatewayProxyResponse` to customise the HTTP response.

**Describe alternatives you've considered**
N/A

**Additional context**
It may make sense to remove the `error` return value from the handler altogether, but this would obviously break pretty much all existing code.

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.