`lambda is not a function` error thrown when handler is misspelled
See original GitHub issueThis is a (Bug Report)
Description
A Type Error is thrown (lambda is not a function
) when the handler within serverless.yml
is misspelled and the function is invoked locally. I feel like there could be a better check / error to report such an error.
For bug reports:
-
What went wrong?
-
What did you expect should have happened? A more useful error message
-
What was the config you used? Any basic helloworld
serverless.yml
will do the trick. -
What stacktrace or error message from your provider did you see? nil
Additional Data
To fix this bug, within the serverless.yml
I went from:
createThingType:
handler: handler.createThing
to:
createThingType:
handler: handler.createThingType
There was no function in the handler file called createThing but there was a method called createThingType.
Function was invoked using the following: $ DEBUG=* sls invoke local -f createThingType
.
- Provider Error messages: Type Error: lambda is not a function
Issue Analytics
- State:
- Created 6 years ago
- Reactions:17
- Comments:10 (5 by maintainers)
Top Results From Across the Web
AWS Lambda function errors in Node.js
If Lambda encounters an error, it returns an exception type, message, and HTTP status code that indicates the cause of the error.
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >Debugging with Dashbird: Lambda Configuration Error
This error can have many causes, but it simply means that the Lambda service can't reach your handler function. Lambda is a function...
Read more >"Type Error: lambda is not a function" in handler with multiple ...
I have two functions in my handler.js file and I have configured them correctly in serverless.yml. The problem is, when I run invocation, ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
lambda is not a function
is a terrible error message. I had no idea it meant that it couldn’t find the handler I specified.Couldn't find the specified handler function
would be better.@shahzeb1 I am suspecting that AWS doesn’t allows a handler file to export anything than a
handler
function. Correct me if I am wrong.@HyperBrain +1 to add a check on whether the defined exported name is has actually been exported. We could also list all the exported functions of the file as a suggestion, like:
The handler doesn't export a function called "createThing". Did you mean "createThingType", "createAnotherThingType"?