AWS API Gateway Integration Response Body Not Mapping Correctly with Lambda Proxy Integration
I'm working through a tutorial and I'm integrating two systems and I tried several approaches but none seem to work. This might be a silly question, but I've looked through the documentation and I'm still confused about I'm experiencing issues with my AWS API Gateway not correctly mapping the response body from my Lambda function when using Lambda Proxy Integration. I set up an API Gateway endpoint that triggers a Lambda function, and I'm returning a JSON response, but it seems the API Gateway is not interpreting the output correctly. Here's the response from my Lambda function: ```python def lambda_handler(event, context): return { 'statusCode': 200, 'body': json.dumps({'message': 'Hello, World!', 'status': 'success'}) } ``` However, when I call the endpoint, I receive a response that includes the body in a nested format: ```json { "statusCode": 200, "body": "{\"message\": \"Hello, World!\", \"status\": \"success\"}" } ``` It seems that the `body` is being double-encoded, as I expected to get the JSON directly instead of a string representation of it. I checked the response mapping templates in API Gateway, but it seems like they are not being used because I have Lambda Proxy Integration enabled. I've tried modifying my Lambda function to directly return a string instead of an object, but it doesnโt seem to help. I also verified that my API Gateway is set to return `application/json` in the response headers. Any ideas on how to resolve this issue? This is particularly frustrating with the `body` being returned as a string rather than as a proper JSON object. I'm using AWS API Gateway (REST API) and the Lambda function deployed in Python 3.8. I've searched for similar issues but havenโt found a clear solution. Is there an additional configuration step I might be missing in the API Gateway settings? How would you solve this? This is part of a larger service I'm building. What am I doing wrong? This is part of a larger web app I'm building. The project is a service built with Python. Has anyone dealt with something similar?