I have a resource in API Gateway /{id}/contacts, which calls my lambda method contacts.
In the lambda, how do I access the {id} from the path, or pass it in the event body in the api gateway?
exports.handler = (event, context, callback) => {...}
I checked the 'Use Lambda Proxy integration' but the event does not contain that data in the lambda itself.
I got it working.
After checking off Use Lambda Proxy integration I also had to handle the HTTP response in the code, which I didn't do at first and got errors.
The path data does appear in the event object now, but the function needs to return output with HTTP data as well, like this:
var response = {
statusCode: 200,
headers: {
"x-custom-header" : "my custom header value"
},
body: JSON.stringify(event)
};
callback(null, response);