HTTP API returns undefined value outside AWS Lambda test environment

Viewed 454

I am trying to pass a simple key1 parameter through an HTTP API to my Lambda Function. When I do a test it works when I pass a simple value {"key1": "value1"}, however, when I use my HTTP API connected to the lambda function to make the same call using Postman, it returns undefined instead of value1 like the test environment did.

My temp API: https://5fitm6ca95.execute-api.us-east-1.amazonaws.com/default/getPresignedURLforEmailAttachments

Lambda:

exports.handler = async (event) => {
    // TODO implement
    const response = {
        statusCode: 200,
        body: "They key is " + event.key1 + ". Event console log: " + JSON.stringify(event),
    };
    return response;
};

I tried to add queryStringParameters to the event as described by this answer but it didn't work.

UPDATE: Below is what comes in the Postman response. I just can't figure out how to access it with my Lambda. I tried event.body.key1 but it didn't work. Response still comes as undefined:

enter image description here

1 Answers
Related