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

1.4K
Visualizações
AWS Lambda function returning Runtime.HandlerNotFound error

I am new to AWS Lambdas - I am trying to write a lambda function to retrieve some data from firebase. I have called this function exports.handler and uploaded it to the Lambda with the node modules as a Zip file. However, when I try to run it, it returns the following error:

{
  "errorType": "Runtime.HandlerNotFound",
  "errorMessage": "index.handler is undefined or not exported",
  "trace": [
    "Runtime.HandlerNotFound: index.handler is undefined or not exported",
    "    at Object.module.exports.load (/var/runtime/UserFunction.js:144:11)",
    "    at Object.<anonymous> (/var/runtime/index.js:43:30)",
    "    at Module._compile (internal/modules/cjs/loader.js:1156:30)",
    "    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)",
    "    at Module.load (internal/modules/cjs/loader.js:1000:32)",
    "    at Function.Module._load (internal/modules/cjs/loader.js:899

Here is my function:

module.exports.handler = async (event) =>{
    ref.on("value", function(snapshot) {
        snapshot.forEach(function(childSnapshot) {
            responses.push({
                date: childSnapshot.val().Date,
                name:childSnapshot.val().name,
                response: childSnapshot.val().response
            })
        });
        printObjects(responses);
        console.log(json(responsesByPerson));
    })
})

I have looked at the other answers to questions similar to mine and implemented some of those solutions but none have worked.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

When we zip a directory the shell directory is also added to the zip while the Lambda expects it to be without the shell directory. Use the below command to create the zip correctly.

$ cd my_lambda_fun
$ zip -r lambda_one.zip .
over 4 years ago · Santiago Trujillo Relatório

0

Ensure index.js is in the root of the Lambda function directory

over 4 years ago · Santiago Trujillo Relatório

0

zip -r lambda_one.zip . worked for me

over 4 years ago · Santiago Trujillo Relatório
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