-
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 still fails for go with --use-container
#6635
Comments
Hi there, I assume you have more than one lambda function inside In the meantime, you can workaround issue with following steps;
Here was my folder structure and template;
|
Thanks for fast respose @mndeveci. I actually only have one function inside the
I tried to use the same as in your hello world example (without the Makefile), but that didn't work for me either with the same errors. Do you have a working template/structure that works inside the container? |
@michal-sa if you have single lambda function, then you can move your
and your function resource should look like this;
Please let us know if this does work for your case |
Thanks for detailed example @mndeveci. TL;DRI managed to get the build inside of container to work (with some workarounds especially for the I have now tested the structure you suggested using hello-world with
|
I finally got some time to try out a more complex project structure containing references outside of the SAM container mount point. Had to create some pre processing scripts copying the dependent directories into the SAM CodeUri folder, replacing all After doing this the lambda built inside the container without errors and worked fine during runtime as well. Think this issue could be closed as the build inside container does work (although with some workarounds). |
Patch is released in v1.111.0. Closing |
Not able to get this running, going to use prebuilt |
Description:
Related to: #5280 building a template containing a SAM go function still doesn't seem to work.
Steps to reproduce:
Boostrap handler
Function resource following the format from: https://aws.amazon.com/blogs/compute/migrating-aws-lambda-functions-from-the-go1-x-runtime-to-the-custom-runtime-on-amazon-linux-2/:
Still gives the error message:
aws_lambda_builders.exceptions.WorkflowFailedError: GoModulesBuilder:Build - Builder Failed: go: go.mod file not found in current directory or any parent directory; see 'go help modules'
Standard handler
Changing the template resource to:
Instead gives a lot of errors about git not being present in path, for example:
git init --bare in /root/go/pkg/mod/cache/vcs/0a897d51bfc9ae666ee1454be13381a5c8df2e3bb2a5bd1dba78528978aa3b56: exec: "git": executable file not found in $PATH
Expected result:
Sam build manages to build the go inside a container without any issues
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:SAM CLI, version 1.108.0
Paste the output of
sam --info
hereThe text was updated successfully, but these errors were encountered: