Error handling with API Gateway and Go Lambda functions

Sergio Garcez
Apr 24, 2018 · 6 min read
The API Gateway pattern relies on a facade/gated proxy service.

Client facing errors

AWS API Gateway

Errors can originate from various sources within a serverless application

Gateway responses

Integration responses

Lambda error responses

The Lambda error response includes the actual type of the original error, see Go source, and the error value.
The error value is the JSON encoded structured error.
The handler does not know how this response will be processed by the gateway before being sent to the client.

Response mappings in API Gateway

Note that a 404 method response must also be defined for that endpoint.

Conclusion

One more thing: Integration testing with SAM Local

References

Thanks to Christian Klotz

Sergio Garcez

Written by

London based freelance software developer, interested in way too many things.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade