Chaining lambdas to run in Sequence

I am facing some headaches with certain lambdas that i have.

Certain lambda has a big amount of business logic and third-party API calls which makes his response slower and times out sometime.

I would like to split this lambda em two so i can run both in sequence, so i can split this business logic
So, a webhook triggers my lambda 1, and after finishing some logic, i want to get it’s response and sent to lambda2 to ben ran , but i cant call lambda2 inside lambda1 as it counts only with one call for lambda1 and it can times out when lambda2 is running.

So, is it possible to have a chain of lambdas being ran to avoid timeout issue?

This is more of a third-party setup question. In your frontend, you could do something like:

fetch('/api/1').then(() => {
  fetch('/api/2)
})

This will call API 2 only after API 1 is done. It’s a very simplified example, and you’d definitely need to improve it.

Depending on how your webhook is triggering API 1, you should also be able to do it there.