"No matching handler found" when handlers aren't in the root folder
See original GitHub issueThis is a (Bug Report)
Since the version 2.2 and this PR my config is broken.
Description
When the lambda handlers aren’t in the root folder (this.serverless.config.servicePath) serverless-webpack doesn’t find them.
$ serverless deploy Serverless Error --------------------------------------- No matching handler found for ‘TestHandler’. Check your service definition.
Reading the code, I understand that the plugin is looking for the files in the root folder, but in my project, neither the original typecript files nor the transpired files are there.
const files = glob.sync(`${fileName}.*`, {
cwd: this.serverless.config.servicePath,
nodir: true
});
The hierarchy:
-app
- handlers/ (all the lambda handlers)
-dist (webpack output path)
-serverless.yml
-webpack.config.js
-package.json
Additional Data
I initialized a test repo to show the behavior: https://github.com/jerep6/serverless-webpack-issue
- Serverless-Webpack Version you’re using: 2.2.2
- Webpack version you’re using: 3.3.5
- Serverless Framework Version you’re using: 1.19.0
- Operating System: MacOS
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
phpunit mockery No matching handler found - Stack Overflow
If I run phpunit separately, works fine and all test passed, but if I use the directory which contains the 2 classes... the...
Read more >Introduction to Razor Pages in ASP.NET Core - Microsoft Learn
The following table shows a Razor Page path and the matching URL: ... White space, numbers, and special characters are not allowed.
Read more >AbstractUrlHandlerMapping (Spring Framework 6.0.3 API)
Abstract base class for URL-mapped HandlerMapping implementations. Supports literal matches and pattern matches such as "/test/*", "/test/**", and others.
Read more >gin - Go Packages
FullPath returns a matched route full path. For not found routes returns an empty string. router.GET("/user/:id", func(c *gin.Context) { c.
Read more >Routing - Express.js
Query strings are not part of the route path. Here are some examples of route paths based on strings. This route path will...
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
Thanks for creating the issue 👍 .This is because your handler definition in your
serverless.yml
seems to not match your handler locations. In Serverless, function handlers have to point to their respective locations if located in subdirectories (at least for AWS and OpenWhisk) - only Google is different as they do not have a file-based handler concept.serverless-webpack
since version 2.2 enforces that the definitions are correct.Can you please check if your handler definitions in
serverless.yml
are correct? I.e. if your handler file is somewhere in<service_dir>/src/handlers/myhandler.js
the handler definition in the yaml file must besrc/handlers/myhandler.myfunc
.Closing the issue as you found a solution 😃