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

395
Visualizações
Serverless Express Lambda async invoke not working

I have a basic Serverless Express app in a lambda, with a route set to async true. I want to trigger this route asynchronously from a different application, and expect it to run in the background without having to wait for the response.

The route in serverless.yml

- http:
    path: foo/{any+}
    method: post
    async: true
- http:
    path: another/sync-route
    method: post

Note: I have other routes in here that are not invoked asynchronously.

When I call this method, it correctly returns a 200 response immediately. But the actual code is never run, I have a DB insert in there, and it doesn't happen. In the API Gateway I can see the X-Amz-Invocation-Type header is correctly being passed as Event type.

Integration Request HTTP headers

What am I missing here? The route controller is a test and the code is very simple

 testAsync: async (req, res) => {
    console.log("In Test Async");  // Does not display in Cloudwatch
    try {
      const { value } = req.body;
      const resp = await updateTest(value);  // This just inserts an entry in the DB with value
      return res.send(resp);
    } catch (err) {
      return res.status(500).send(err);
    }
  },

Is there any other setting I'm missing here? I'm not an AWS expert, so any help would be highly appreciated. Thanks!

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