How to Resolve Serverless error: lambda is not a function

Sharing is Caring

For those not aware, the serverless framework is amazing for abstracting away a lot of the differences between AWS, Azure, and the other cloud providers. The serverless framework works by having a common building, compiling and transporting code in a consistent manner to the relevant cloud provider. It can even use CloudFormation stacks to create and provision resources within AWS.

When trying to invoke any of your lambda functions if you are getting an error that says “lambda is not a function” the problem is likely that the handler is misspelled in the serverless.yml file OR you aren’t exporting modules.exports.handler and are instead exporting something else.

In the serverless.yml file make sure that the case matches exactly how the handler and file system are named. For example, if your function is located in /functions/my-function.js and exports module.exports.handler than the path is likely wrong because of case sensitivity or spelling.

Sharing is Caring

Brian is a software architect and technology leader living in Niagara Falls with 13+ years of development experience. He is passionate about automation, business process re-engineering, and building a better tomorrow.

Brian is a proud father of four: two boys, and two girls and has been happily married to Crystal for more than ten years. From time to time, Brian may post about his faith, his family, and definitely about technology.