In this step, you will test the FetchInvoiceDetailsFunction Lambda Function. This function is responsible for reading and updating invoice information from DynamoDB through API endpoints such as GET or PATCH. Testing will help verify that the Lambda function works correctly when receiving input from API Gateway.
⚠️ Make sure you already have at least one invoice file in your S3 Bucket and a corresponding record in the InvoiceData DynamoDB table before starting the test.
Open the AWS Lambda Console.

Select the FetchInvoiceDetailsFunction function.

Switch to the Test tab.
Scroll down to the Test event section and configure it as follows:
TestGetInvoice
Paste the following JSON into the event content:
{
"httpMethod": "GET",
"path": "/invoice/demo_invoice.png",
"pathParameters": {
"id": "Your_InvoiceId"
}
}
📌 Replace the
"id"value with a valid InvoiceId that exists in the InvoiceData DynamoDB table.

Scroll up and click Save.

After creating the Test Event, click the Test button to execute it.

Observe the Execution results displayed after running:
