1

I have a lambda function which works correctly when I test in the AWS Lambda dashboard, however any json data I post to the function appears to be ignored.

If I test with curl:

curl -X POST -H "Content-Type: application/json" -d '{ "email":"[email protected]", "fullname":"Mr Tester", "address":"1 Street" }' https://API.Gateway.url

In the lambda function code using

exports.handler = function(event, context, callback) {..}

event.email is always null.

0

1 Answer 1

0

You need to create a entry in your apigateway configuration, under resources, select post method -> integration request , under body mapping templates. you can add a application/json content type and add a template for matching your request body json.

The template can be generic like given below or can be designed to suit your parameters.

  {
    "body" : $input.json('$')
  }

Refer this for further information : Cannot send POST data to Lambda

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.