-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Bug: sam local invoke "Cannot find module 'index'" (happens when running from docker container only) #6569
Comments
Hi @osotnikov, I tried reproducing this on a linux machine but got the same output as the Windows one you have.
This might be an issue with the container configuration. Will try installing SAM CLI and reproducing the behavior using |
I found what the issue is. Basically I am running This is a similar issue to mine: #4589 |
|
Sorry, tried it again today and having the same issue as before, it's working on windows but not from sam local invoked in a docker container:
For some reason it's appending HelloWorldFunction at the end of the path it mounts. HelloWorldFunction is the name of my function in the template but dist folder has no folder of such name. The same happens even if I create HelloWorldFunction, change CodUri accordingly and move index.js to that folder. Everything works fine on the windows host though. Maybe my python was updated since I just download the latest in my Dockerfile. I don't think sam was updated though. Same thing happens when I call
with output
|
Description:
When doing a
sam build
followed by asam local invoke
on a simple hello world lambda (nodejs16) everything works fine on windows but fails on linux (docker container, ubuntu:jammy-20220801).Steps to reproduce:
Install nodejs 16 (although same observed on 20 as well). Create a small helloWorld.js lambda, create a basic template.yaml, run sam build, run sam local invoke.
Observed result:
On windows:
On jammy docker container:
same happens with node 16.13 as well...
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
docker container works on the same folder as windows with parent folder being mounted as volume.
The text was updated successfully, but these errors were encountered: