Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
AWS Lambda: extract id from path

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.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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);
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!