admin管理员组

文章数量:1319017

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?

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?

Share Improve this question asked Aug 19, 2018 at 21:22 xhawxhaw 311 gold badge1 silver badge2 bronze badges 2
  • 1 Can you share more details? For example the mapping template? – Alex Moore Commented Aug 19, 2018 at 21:27
  • Do you pass it to a custom authorizer lambda before your business logic lambda? – maxwell Commented Aug 19, 2018 at 21:30
Add a ment  | 

1 Answer 1

Reset to default 6

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.

本文标签: javascripthow to take url parameters from AWS API Gateway and input them into lambdaStack Overflow