Step 1: Enable the
simulated issue and send a second API request
-
Sign in to the AWS Lambda console
. -
On the navigation panel, choose Functions.
-
Search for
serverlessrepo-fork-example
and chooseCheckoutFunction
. -
On the fork-example-ecommerce-
my-app
-CheckoutFunction-ABCDEF
... page, in the Environment variables section, set the BUG_ENABLED variable to true and then choose Save. -
Copy the following JSON to a file named
test_event_2.json
.{ "id": 9917, "date": "2019-03-26T21:11:10-08:00", "status": "confirmed", "customer": { "id": 56999, "quantity": 1, "price": 75.00, "subtotal": 75.00 }] }
-
To send an HTTPS request to your API endpoint, pass the sample event payload as input by executing a
curl
command, for example:curl -d "$(cat test_event_2.json)" https://abcdefghij.execute-api.us-east-2.amazonaws.com/Prod/checkout
The API returns the following empty response, indicating a successful execution:
{ }
Step 2: Verify simulated data
corruption
-
Sign in to the Amazon DynamoDB console
. -
On the navigation panel, choose Tables.
-
Search for
serverlessrepo-fork-example
and chooseCheckoutTable
. -
On the table details page, choose Items and then choose the created item.
The stored attributes are displayed, some marked as CORRUPTED!
Step 3: Disable the simulated
issue
-
Sign in to the AWS Lambda console
. -
On the navigation panel, choose Functions.
-
Search for
serverlessrepo-fork-example
and chooseCheckoutFunction
. -
On the fork-example-ecommerce-
my-app
-CheckoutFunction-ABCDEF
... page, in the Environment variables section, set the BUG_ENABLED variable to false and then choose Save.
Step 4: Enable replay
to recover from the issue
-
In the AWS Lambda console, on the navigation panel, choose Functions.
-
Search for
serverlessrepo-fork-example
and chooseReplayFunction
. -
Expand the Designer section, choose the SQS tile and then, in the SQS section, choose Enabled.
Note
It takes approximately 1 minute for the Amazon SQS event source trigger to become enabled.
-
Choose Save.
-
To view the recovered attributes, return to the Amazon DynamoDB console.
-
To disable replay, return to the AWS Lambda console and disable the Amazon SQS event source trigger for
ReplayFunction
.