`ModuleNotFoundError` when locally invoking a python function
See original GitHub issueIn a project with both node and python functions, when you run serverless invoke local -f pythonFunction -d "{}"
you receive a ModuleNotFoundError
. If you comment out the serverless-esbuild
plugin in the serverless.yml
file it works.
I have attached an archive to reproduce the issue.
Repro steps:
npm install
sls invoke local -f hello -d "{}"
- This should complete successfully
sls invoke local -f world -d "{}"
- This will fail with the
ModuleNotFoundError
- Comment out the
serverless-esbuild
plugin sls invoke local -f world -d "{}"
- This should complete successfully
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
ModuleNotFoundError: no module named Python Error [Fixed]
When you try to import a module in a Python file, Python tries to resolve this module in several ways. · As the...
Read more >How to Fix ModuleNotFoundError and ImportError
first make sure you are using absolute imports · export the project's root directory to PYTHONPATH.
Read more >"Module not found error" while trying to call a function that is in ...
Trying to call a function yamlCreation() which is in another directory into this python file .. the path of this file is.
Read more >Python Import Error (ModuleNotFoundError) - Finxter
An ImportError is detected when Python has problems with a successful module import. Usually this problem is caused by the incorrect path and...
Read more >`ModuleNotFoundError` when locally invoking a python function
In a project with both node and python functions, when you run serverless invoke local -f pythonFunction -d "{}" you receive a ModuleNotFoundError...
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 FreeTop 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
Top GitHub Comments
Finally got some time to look into this again. I’ve tried the suggestion from https://github.com/floydspace/serverless-esbuild/issues/225#issuecomment-964850136 as well as the suggestions from the serverless docs and still am encountering the same issue and if I comment out the
serverless-esbuild
plugin, it works. I’ve included a zip file to hopefully be able to reproduce or tell me what I’m missing.Here is my serverless.yml
python-test.zip
🎉 This issue has been resolved in version 1.22.2 🎉
The release is available on:
Your semantic-release bot 📦🚀