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

400
Views
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
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!