Troubleshooting Common Errors With AWS API Gateway

Adding an API Gateway to your application is a good way to centralize some work you usually have to do for all of your API routes, like authentication or validation. But like every software system, it comes with its own problems. Solving errors in the cloud isn’t always straightforward, and API Gateway isn’t an exception.

What is AWS API Gateway?

AWS API Gateway is an HTTP gateway, and as such, it uses the well-known HTTP status codes to convey its errors to you. Errors in the range of 400 to 499 usually point to a problem with the API client, and errors in the range of 500 to 599 mean something on the server is wrong.

This is a rule of thumb, and if you don’t have any logic bugs in your backend, it holds. But nobody is perfect, and so it could happen that a 400 code still means your client is right and your backend is wrong. But let’s not get ahead of us and look into the errors, case by case.

API Gateway Error Codes

Here’s a table summarizing common errors encountered in AWS API Gateway:

Error Description
400 Error: Bad Request This error is often due to invalid JSON, missing fields, wrong data types, or invalid characters in the API request.
403 Error: Access Denied This error, also known as “Forbidden,” usually arises from permission issues related to the IAM role of the API Gateway or AWS Cognito.
404 Error: Not Found This error typically indicates an incorrect URL or an attempt to access non-existent data in the services integrated with API Gateway.
409 Error: Conflict This error indicates a conflict with a resource’s current state, often related to a caller’s reference.
429 Error: Limit Exceeded This error signals that you’ve exceeded an API quota, often due to the usage limit of an API key.
500 Error: Internal Server Error This is a catch-all error and could imply a buggy code, inconsistent error mapping, or other technical issues.
502 Error: Bad Gateway This error suggests a problem with the service integrated with your API Gateway, like connection issues or invalid response structures.
503 Error: Service Unavailable A common error that signifies the service took too long to respond.
504 Error: Endpoint Request Timed-out This error could indicate DNS or network problems, often arising when an integrated service isn’t running or IP/hostname is incorrect.

Handling API Gateway issues is a significant part of ensuring smooth operation of your services. For more in-depth information on each error, click on the error code to read more. Don’t forget to monitor your system carefully and investigate promptly when you encounter these error codes.

Monitoring AWS API Gateway

We went over all the API Gateway errors you will probably encounter, and like with anything debugging-related, things can get quite messy — especially if you have countless rows of logs to sift through.

Monitor AWS API Gateway with Dashbird

The good news is that Dashbird integrates well with API Gateway monitoring and delivers actionable insights straight to your Slack or SMS when things go awry.

Dashbird also works with AWS as their Advanced Technology Partner and uses the AWS Well-Architected Framework to ensure you’re on track to performance and cost optimization. If you want to try Dashbird out, it’s free for the first 1 million invocations per month.

Read our blog

4 Tips for AWS Lambda Performance Optimization

In this article, we’re covering 4 tips for AWS Lambda optimization for production. Covering error handling, memory provisioning, monitoring, performance, and more.

AWS Lambda Free Tier: Where Are The Limits?

In this article we’ll go through the ins and outs of AWS Lambda pricing model, how it works, what additional charges you might be looking at and what’s in the fine print.

AWS Lambda vs EC2: A Comparative Guide

More articles

Made by developers for developers

Dashbird was born out of our own need for an enhanced serverless debugging and monitoring tool, and we take pride in being developers.

What our customers say

Dashbird gives us a simple and easy to use tool to have peace of mind and know that all of our Serverless functions are running correctly. We are instantly aware now if there’s a problem. We love the fact that we have enough information in the Slack notification itself to take appropriate action immediately and know exactly where the issue occurred.

Thanks to Dashbird the time to discover the occurrence of an issue reduced from 2-4 hours to a matter of seconds or minutes. It also means that hundreds of dollars are saved every month.

Great onboarding: it takes just a couple of minutes to connect an AWS account to an organization in Dashbird. The UI is clean and gives a good overview of what is happening with the Lambdas and API Gateways in the account.

I mean, it is just extremely time-saving. It’s so efficient! I don’t think it’s an exaggeration or dramatic to say that Dashbird has been a lifesaver for us.

Dashbird provides an easier interface to monitor and debug problems with our Lambdas. Relevant logs are simple to find and view. Dashbird’s support has been good, and they take product suggestions with grace.

Great UI. Easy to navigate through CloudWatch logs. Simple setup.

Dashbird helped us refine the size of our Lambdas, resulting in significantly reduced costs. We have Dashbird alert us in seconds via email when any of our functions behaves abnormally. Their app immediately makes the cause and severity of errors obvious.