-
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
SAM Build Not Mounting Lambda Code in /var/task
During sam local start api
on Windows
#7478
Comments
Looks like a SAM CLI issue, transferring over to them |
Hi thanks for raising this issue! Could you provide the output generated by sam cli when running the commands with the |
Command used: sam local start-api --warm-containers LAZY --host 0.0.0.0 -p 13000 --docker-network my_network --container-host 127.0.0.1 --template template.yml --env-vars tests/resources/environment.json --log-file logs.txt --invoke-image myprivaterepo/public.ecr.aws/lambda/nodejs:20 SAM CLI Output:
Inside the container: |
I don't use sam build for building my project and generating the /dist folder, my project is built with npx tsc --project tsconfig.build.json . |
Description:
When using
npm run build
and runningsam local start api
orsam local invoke
, SAM builds the Lambda image on the fly. However, it seems that the Lambda code is not being mounted correctly in/var/task
, which results in an empty directory. This prevents the Lambda from executing properly.Context:
I expect SAM to mount the built Lambda sources from
dist/
into/var/task
inside the container. However, the/var/task
directory is empty, making it impossible to execute the Lambda function viasam local start api
.I've tried multiple solutions but couldn't resolve this issue. It might be related to switching from a Linux development environment to a Windows environment.
In my
template.yml
, I point theCodeUri
to the compiled code in thedist/
directory, like this:Expected behavior:
The compiled Lambda code should be mounted into
/var/task
inside the container to allow the Lambda function to execute properly.Environment:
template.yml
Steps to reproduce:
npm run build
. [npx tsc --project tsconfig.build.json]sam local start api
orsam local invoke
./var/task
is empty.Possible suggestions or fixes:
/var/task
directory during execution on Windows.Thank you for your help!
The text was updated successfully, but these errors were encountered: