Reputation: 31
I have setup my API gateway and hooked it up to my lambda function
I set the url to {id} and want to pass this parameter into the lambda,
However even after trying multiple intergration requests using the default template and a custom one , the lambda still cant detect the paramters passed in the api gateway (id)
Ive tried assigning id to different parameters in my node js lambda function mapping it to path.params.id and other variables even tried the string query but it still isnt being detected in the lambda any ideas?
Upvotes: 2
Views: 10611
Reputation: 31761
Here's an example lambda function that pulls out an id
path parameter:
module.exports.get = (event, context, callback) => {
const { id } = event.pathParameters;
console.log("id", id);
};
You can also get query string parameters with event.queryStringParameters
.
A detailed example can be found in the AWS documentation.
Upvotes: 6