question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"No matching handler found" when handlers aren't in the root folder

See original GitHub issue

This 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:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
HyperBraincommented, Aug 27, 2017

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 be src/handlers/myhandler.myfunc.

0reactions
HyperBraincommented, Sep 6, 2017

Closing the issue as you found a solution 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found