最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to take url parameters from AWS API Gateway and input them into lambda - Stack Overflow

programmeradmin0浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论