4 Pizza delivery: Connecting an external service
This chapter covers
- Connecting your serverless function to an external service using an HTTP API
- Dealing with common problems in async communication with Claudia API Builder
As you learned in the previous chapter, handling asynchronous operations in AWS Lambda is easy with Claudia API Builder. In that chapter, you also learned how to create a database for your pizza orders and created functions to store, retrieve, update, and delete them. But your application is capable of much more than that.
This chapter shows you how to connect your serverless application to an external HTTP service by enabling Aunt Maria’s pizzeria to use the Some Like It Hot Delivery Company’s API and offer more home delivery services. You will learn how to formulate an HTTP request from AWS Lambda, handle response errors, and set up a webhook with Claudia API Builder. You will also learn about the most common problems and pitfalls, how to solve them, and how to avoid encountering them in the first place.
4.1 Connecting to an external service
Ring, ring! Aunt Maria is on the phone again. She sounds pleased and thanks you for your current work, but you can sense that something is bothering her. It’s not long until she asks you for a favor.