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

172
Views
TypeError: Cannot read property 'id' of undefined - AWS Lamnbda, NodeJS

I'm brand new to NodeJS and I recently updated the runtime of my AWS Lambda functions from 8.10 to 14. I've ensured all deprecated code has been udpated. I'm not trying to fully deploy my Lambdas. When testing in the AWS Lambda console, I get the following error:

{
  "errorType": "TypeError",
  "errorMessage": "Cannot read property 'id' of undefined",
  "trace": [
    "TypeError: Cannot read property 'id' of undefined",
    "    at Runtime.exports.handler (/var/task/index.js:11:69)",
    "    at processTicksAndRejections (internal/process/task_queues.js:95:5)"
  ]
}

Here's some of the code used in the Lambda function (emitting a function that is irrelevant to the issue):

exports.handler = async(event) => {
    // TODO implement
    const response = {
        statusCode: 200,
        body: JSON.stringify('Hello from Lambda!'),
    };
    console.log(event);
    let body = await createJSONBody(event);
    let res = await makeHTTPPost(body);
    response.statusCode = 200,
    response.body = `Created Ticket Number: ${JSON.parse(res).ticket.id}`
    return response;
};

function createJSONBody(event) {
    return new Promise((resolve, reject) => {
        let requesterID = event.requester_id ? event.requester_id : 1234567890;
        let subject = event.subject;
        let priority = event.priority;
        let commentBody = event.comment_body;
        let pkc = event.pkc;
        console.log(pkc)
        let ticket = {
            "ticket": {
                priority: priority,
                requester_id: requesterID,
                subject: subject,
                tags: ['from_aws'],
                custom_fields: [{
                    "id": 12345,
                    "value": pkc
                }],
                comment: {
                    body: commentBody,
                    "public": false
                }
            }
        };
        resolve(ticket);
    });
}

What I've tried so far:

  • TypeError: Cannot read property 'id' of undefined - AWS Lambda
  • Serverless : "errorMessage": "Cannot read property 'id' of undefined",

Does anyone have an idea about what's going on? I really appreciate any and all help. Thank you.

about 4 years ago · Juan Pablo Isaza
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!