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

Module not found after upgrading from 1.25.0 - 1.26.0 #4693

Closed
andrewspinks opened this issue Jan 30, 2018 · 2 comments
Closed

Module not found after upgrading from 1.25.0 - 1.26.0 #4693

andrewspinks opened this issue Jan 30, 2018 · 2 comments

Comments

@andrewspinks
Copy link

andrewspinks commented Jan 30, 2018

This is a Bug Report

Description

My serverless definition uses a module called serverless as in the following configuration.

functions:
  myFunction:
    handler: serverless.handler

After upgrading to 1.26.0 I kept getting the error Unable to import module 'serverless': Error at require (internal/module.js:20:19).
After looking at the deployed code it looks like my serverless.js module is no longer being included in the source uploaded to lambda. I assume this is due to this change: #4590. Renaming our entry module to a name other than serverless.js fixes the problem.

If serverless.js is now a reserved name used for configuration files, it would be good to have some sort of warning when using it like this!

Additional Data

  • Serverless Framework Version you're using:
    1.26.0
  • Operating System:
    macOS / alpine linux
  • Stack Trace:
  • Provider Error messages:
@HyperBrain
Copy link
Member

Hi @andrewspinks , thanks for reporting this. Imo it is a bug, because the serverless.js must only be evaluated and handled, if there is no serverless.yml nor a serverless.json available for the service configuration.
Otherwise it has to be treated as user code. We should not restrict users with their names of their handler files.

@pmuens
Copy link
Contributor

pmuens commented Feb 13, 2019

Closing this issue since it's quite stale and we've published a couple of versions in the meantime. Feel free to re-open if this is still an issue.

@pmuens pmuens closed this as completed Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants