Skip to content

Getting Error: ENOENT when trying to add a module with one folder #517

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

Open
cscetbon opened this issue May 14, 2020 · 8 comments
Open

Getting Error: ENOENT when trying to add a module with one folder #517

cscetbon opened this issue May 14, 2020 · 8 comments

Comments

@cscetbon
Copy link

cscetbon commented May 14, 2020

All the files used can be found at https://github.com/cscetbon/sls-dd-missing-folder.
Following https://www.npmjs.com/package/serverless-python-requirements, I can package functions f1 and f2, but not f3 which is in a folder:

$ sls package
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...

  Error --------------------------------------------------

  Error: ENOENT: no such file or directory, open '.serverless/sources/f3-sls-no-such-folder-dev-f3.zip'
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              14.1.0
     Framework Version:         1.70.1
     Plugin Version:            3.6.11
     SDK Version:               2.3.0
     Components Version:        2.30.10

If I remove f3 from the configuration I got no problem. Somehow, having one more level breaks it.

@cturner-confluent
Copy link

I ran into this same issue with my project.

@cscetbon
Copy link
Author

@cturner-confluent unfortunately there doesn’t seem to be much activity on that project when i see that no one responded in 15 days ...

@cturner-confluent
Copy link

Yeah makes me sad the serverless framework is obviously more focused around a NodeJS dev env. I may just have to switch over to using that instead of python. I did see this article where it looks like they have a nested folder structure
https://medium.com/@nate_mitchell/serverless-packaging-user-defined-python-modules-41808776eae0
but not sure if it really works.

@cscetbon
Copy link
Author

Yeah I think those modules should be part of the framework itself instead of being plugins cause those are general functionalities. At least a few languages other than nodes and ensure they are well supported

@ComfyDust
Copy link

Ran into this error myself and was able to resolve it by creating an empty requirements.txt file in the folder that contains the Lambda function module.

@MichaelRBond
Copy link

I'm seeing a similar issue where the serverless framework is creating a zip file in the root of the serverless directory, but this plugin is looking for it as a nested file with a different naming convention.

created zip:

.serverless/dpf-python-test-lambda.zip

plugin error:

Error: ENOENT: no such file or directory, open '.serverless/path/to/my/lambda/function/python-SERVICE_NAME-dpf-python-test-lambda.zip'

where module = path/to/my/lambda/function/python

@ctrongminh
Copy link

Thanks to @ComfyDust ,
I create an empty file requirements.txt under each python folder, and the problem is gone.
I have the below structure

src
  python1
    python1.py
    requirements.txt
  python2
    python2.py
    requirements.txt

@augustoqm
Copy link

I had a different issue but similar ENOENT error message related with python3.9
After hours of digging I've found out the cause:
When the serverless.yaml > provider > runtime = pythonX but you are using a different python version, you will get an ENOENT error.
In my case I had runtime = 3.9 and local = 3.8.
So learning: Make sure you use the same python version as referred on the provider > runtime.
I hope this helps.

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

6 participants