Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
AWS Lambda Quick Start Guide

You're reading from   AWS Lambda Quick Start Guide Learn how to build and deploy serverless applications on AWS

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781789340198
Length 184 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Markus Klems Markus Klems
Author Profile Icon Markus Klems
Markus Klems
Arrow right icon
View More author details
Toc

Testing and debugging Lambda functions

In the previous section, we learned about programming Lambda function handlers. Now, let's explore testing and debugging.

Here, we are going to look at three different testing and debugging approaches:

  • Using the Serverless framework
  • Using Postman for testing our API
  • Using the AWS Management Console

Let's go back to our handler.js file from the previous section. There are a couple things that should be changed. The response method should be changed back to something that our API can work with.

Give it a body property with a stringify JSON content, as shown here:

body: JSON.stringify({

And, in the JSON content, get back the event in the remaining time from the context, and then, instead of returning an error, we will return the response:

'use strict';
module.exports.hello = (event, context, callback) => {
let remainingTime...
You have been reading a chapter from
AWS Lambda Quick Start Guide
Published in: Jun 2018
Publisher: Packt
ISBN-13: 9781789340198
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image