Monitoring platform for keeping systems up and running at all times.
Full stack visibility across the entire stack.
Detect and resolve any incident in record time.
Conform to industry best practices.
Like any other creation in progress or in the making, serverless applications, need to be tested and monitored. How else would you know if what you’ve created is providing desired results? Before putting your “newborn child” out into the world, you must make sure that it’s ready for the world. Software or even hardware of any sort will first be tested before it goes to mass production, and the same goes for your serverless applications.
Since you can’t just throw them out without making sure they are designed as they should be, we’ll cover the serverless applications testing processes, and we’ll bring you the insight of how and why it’s done the way it is.
When it comes to serverless applications, they are very complex, and this complexity constantly moves further out of the code. The complexity lies inside the function configuration – IAM permissions, memory, timeout, event source configuration, amongst many others. I know there are a lot of terms and acronym relating to serverless metrics so have a look at this post to learn what they all mean. Functions are stateless and they rely solely on external services which manage their application state. This gives us an idea of what’s happening with the number of integration points.
When you start writing the code with the idea of implementing a new feature or even fixing an existing bug, there are various stages in which you’re able to test your code. Every testing stage covers a different angle of your application, while all of them put together will let you realize your serverless application is built the way it should be and it’ll work the way it should work.
We’ll talk about tools which can be very useful to assess quickly if your code works. But be aware that they are also limited regarding how much confidence you can get from them. They will not simulate API authentication nor will they mimic IAM permissions, but they’ll continuously face the battle of keeping up with most recent changes in the platform.
You can choose from several different ways of performing local testing of your code, and here are some:
Since complexities aren’t something you need to worry about anymore within your code, the value of unit tests goes out the window. There’s less and less need for unit tests because the majority of complexities is usually found around how a function interacts with external services. In case you own a piece of complex business logic, what you should do is to put that logic into its own module, and that way you’ll be able to test it as a unit. You can utilize the same testing frameworks which you already know of like Jest, Jasmine, and Mocha since all of them work just fine.
When testing your code against external services you depend on, like S3 or DynamoDB, that’s what’s known as integration testing. Integration testing will allow you to catch errors since it’s considering how your code interacts with external services.
In case your expectations of the response format are incorrect, or if there’s a bug in your DynamoDB query expression, integration testing will help you solve all of these issues. While performing integration testing, you’ll invoke the function locally by passing in a stubbed event as well as context objects. In case the function needs to integrate with the external services, then the function itself should be set to talk to the “real thing.”
All of the tests mentioned above can help you identify potential problems in your code. Is there anything else that might happen? Well, there is. Your functions might not have right IAM permissions set up or even it’s not allowed to communicate with DynamoDB table. Are you having troubles with function’s timeout setting being set too short? Even if not enough memory was allocated, that’s also another issue for you to resolve.
Take into consideration that there are a lot of opportunities that could lead to misconfiguration. You need to try out your functions after their deployment, so you’ll be sure if everything works perfectly and as expected end-to-end. In case you’re using API Gateway and Lambda, make an HTTP request against the deployed API and be sure to validate against the responses so you’ll accomplish an end-to-end test. That is the way you will be able to find permissions and other configuration errors that will almost certainly be missed by unit and integration tests.
If a UI client is using your serverless application directly or not, you should make sure if the changes are compatible with the client. You’re able to run automated visual tests as well as automated tests against different devices and platforms that use services like AWS Device Farm. Also, these tests can be done manually by a Q&A team, or even automated tests via Selenium-like frameworks.
We’ve been through all the testing steps, but there’s always something that can go wrong when it goes into production. AWS can experience an outage which will for sure have a significant impact on your serverless application. Since your serverless application depends on many external services, those services can suffer disruption as well.
Scale-related bugs can show themselves only when the system is under load, which is yet another thing to worry about. Chaos Engineering is a discipline whose main focus on testing the application’s ability to endure turbulent conditions within production. A series of controlled experiments will inject small amounts of failures into the system which will furthermore help to discover the unknown failure modes, and therefore, giving you an opportunity to build a resilience inside your system.
This is where Dashbird shines especially. You can test, retest applications all you want but once that baby goes Live, s*#@ will happen. It’s just how it is. You’ll be able to use Dashbird‘s function view to see exactly how your application is behaving and when the app goes sideways, you’ll be able to use the Incident management platform you can see exactly what broke and where.
After everything we’ve mentioned, we come to realize that the most important thing that you need is an excellent monitoring and error reporting tool for your serverless application, and Dashbird is precisely the tool what you’ve been looking for. Start using it for free(forever) or see all that it has to offer with our two-week Free trial. Also, feel encouraged to share your thoughts in our comment box below.
Further reading:
How to test JavaScript Lambda functions?
Best practices for Lambda logging
How to save hundreds of hours on debugging AWS Lambda
In this guide, we’ll talk about common problems developers face with serverless applications on AWS and share some practical strategies to help you monitor and manage your applications more effectively.
Today we are announcing a new, updated pricing model and the end of free tier for Dashbird.
In this article, we’re covering 4 tips for AWS Lambda optimization for production. Covering error handling, memory provisioning, monitoring, performance, and more.
Dashbird was born out of our own need for an enhanced serverless debugging and monitoring tool, and we take pride in being developers.
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.