Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARNING: More than one matching handlers found for 'handler'. Using 'handler.js'. #405

Closed
romandecker opened this issue Jun 1, 2018 · 9 comments

Comments

@romandecker
Copy link

This is a Bug

Since I've added serverless-webpack to my setup, I get the following warnings (everything still works as expected, though):

WARNING: More than one matching handlers found for 'handler'. Using 'handler.js'.
WARNING: More than one matching handlers found for 'handler'. Using 'handler.js'.
WARNING: More than one matching handlers found for 'handler'. Using 'handler.js'.

For bug reports:

  • What went wrong?
  • What did you expect should have happened?
  • What was the config you used?
  • What stacktrace or error message from your provider did you see?

Additional Data

  • Serverless-Webpack Version you're using: ^5.1.5
  • Webpack version you're using: ^3.8.1
  • Serverless Framework Version you're using: 1.27.3
  • Operating System: Mac OS X 10.13.4
@HyperBrain
Copy link
Member

Hi @DEX3 ,

can you check if the directory, that contains the handler.js file contains other files that match handler.*?

@romandecker
Copy link
Author

Ah yes, I've got handler.test.js from the example. I guess it's not related to serverless-webpack then - sorry about that.

You don't happen to know if I that handler.*-glob is configurable somewhere?

@HyperBrain
Copy link
Member

Currently you cannot configure the glob. But we could exclude everything like .*\.test.\.* from the sanity checks. Then it would automatically ignore any test files located in the handler directory.

@romandecker
Copy link
Author

But is this glob coming from serverless or from serverless-webpack?

@HyperBrain
Copy link
Member

From sls-webpack. It is the sanity check for the handler detection (e.g. you could have a *.ts and *.js file and the warning tells you that the automatic resolution was triggerred for that case).

@nbransby
Copy link

nbransby commented Jul 15, 2018

What if you do have ts and js files and you want it to ingore the ts / js.map files?

@taschmidt
Copy link

@HyperBrain I'm running into the same issue, is there a way I can tell it to ignore my *.test.js files?

@HyperBrain
Copy link
Member

@taschmidt Feel free to open a feature request to add file patterns to a handler lookup exclude list

designfrontier added a commit to designfrontier/serverless-webpack that referenced this issue Jan 5, 2019
This permits you to tell serverless to ignore files that have
similar names to the route handlers. So ignore index.test.js or
index.ts.

This fixes serverless-heaven#433 and serverless-heaven#405

It makes life better for lots of folks :-)
@ezraamos
Copy link

What if you do have ts and js files and you want it to ingore the ts / js.map files?

What if you do have ts and js files and you want it to ingore the ts / js.map files?

have you able to do ths?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants