Issue: API Gateway Response Format Not Matching Expected Output

Hello Team,

I wanted to informed about the issue, i recently came across on AWS Level 4(Building and Managing APIs with AWS API Gateway). I’ve completed the deployment and tested the API Gateway URL:

https://sld92zmwo4.execute-api.us-east-1.amazonaws.com/test

The endpoint successfully returns the following response:

{
“statusCode”: 200,
“body”: “"Hello from Lambda!"”
}

However, the validation tool reports:

“API Gateway did not trigger Lambda as expected. Response: {“statusCode”:200,“body”:““HellofromLambda!””}”

This appears to be due to the Lambda response format — the body is returned as a plain string rather than a structured JSON object (e.g., { "message": "Hello from Lambda!" }).

Since “lambda_function.py” is provided as part of the pipeline and should not editable from our side.

please review and confirm whether the response formatting in the Lambda needs to be updated.
Screenshot 2025-06-29 010352


Hi @Sohelk

The task requires setting up a CodeBuild project to deploy new code to Lambda. You need to make sure the Lambda function uses the updated code provided in the task. You can check this in the lab terminal.

CodeBuild example:

Hello Raymond,

Thank you for your response. I got it, i will try and update on it.

Thanks,
Sohel.