Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda