Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda