Async functions timing out [Bug?]

Hi, can anyone help explain what is going on here. I am using Sequelize ORM with AWS Serverless framework.

  • Function1
async (event) => {
  return {
    statusCode: 200,
    body: JSON.stringify({
      message: 'Function1 endpoint'
    })
  }
}
  • Function2
async (event) => {
  let user = await userModel.find()
  // this returns the user in logs
  console.log(user)
  return {
    statusCode: 200,
    body: JSON.stringify({
      message: 'Function2 endpoint'
    })
  }
}

Function1 works perfectly… however Function2 does not respond to my http request and just times out. I see that let user = await userModel.find() executes and finished as I see user data in the logs.

Everything works locally with sls offline just not with sls deploy

Any help greatly apprieciated!

I’m not sure if this still works but the old solution was adding the following as the first line of your event handler:

context.callbackWaitsForEmptyEventLoop = false;