-
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 builds only one of several AWS::Serverless::Function with the same CodeUri #3348
Comments
Hi thanks for the report! If this is indeed reproducible and the behaviour is affecting you experience., we will evaluate your feature request with our team! |
I'm seeing this exact same issue with a custom runtime. If I run I have separate |
Any update folks? |
Still no update on this? the go1.x runtime is about to be deprecated and I am trying to swap over but this issue is causing me a problem |
I decided to separate the go build process from the sam build command by doing the following. During the build process, it will create a custom .build folder with the binaries in their own individual folder and an auto generated Makefile that will copy the binaries to the artifacts folder.
The base Makefile
the template file looks something like this
so all I will do is run the commands in the following order
|
Apologies for missing this issue but it seems like this is a duplicate of #3894 You can build multiple Go lambda functions, using the provided runtimes today. Here is an example setup.
Here is my
If I build and locally invoke my lambda functions I can get desired outputs;
Couple of things when coming from the go1.x runtime;
|
hi @mndeveci
The build command I am using is this. I had to use the build image because it was trying to use the provided.al2 image which does not have the go command.
output
--UPDATED--- I decided to try running without the |
@marklauyq thanks for the feedback, can you create a new issue for the problem that you are facing? We can take a closer look at it later. |
|
@mndeveci So actually the fix is introducing a new value |
@koote I think it depends for your case. If |
Thanks, when using |
@koote default |
Another option is to use the |
Thanks @aidansteele, will setting the flag in |
Description:
We have a repository that has 8 lambda functions which are all managed from the same sam
template.yaml
file. We are currently migration them fromgo1.x
to theprovided.al2
runtime. The problem is that with the new runtime, the behavior ofsam build
has changed where the same CodeUri no longer works because now you are using the CodeUri as the root of the source code for lambda which was not the case withgo1.x
.Simplified directory structure is this:
Steps to reproduce:
With runtime
go1.x
, we hadCodeUri: ./services/queue/cmd/one/
,CodeUri: ./services/queue/cmd/two/
, etc. That would correctly build themain.go
file. Now, just changingRuntime: go1.x
toRuntime: provided.al2
, it fails becauseCustomMakeBuilder:CopySource
only copies files/directories underCodeUri
which in our case does not work at all.Observed result:
So then, I was like, okay makes sense, I will just set the
CodeUri
for all functions to be the root of the project, and then that succeeds but only the FIRST function is actually built and that executable is copied to all functions because I think you are de-duping onCodeUri
somewhere?Expected result:
I then hacked around it and made
CodeUri: ./services/queue/cmd/one/.aws-sam
,CodeUri: ./services/queue/cmd/two/.aws-sam
, etc. and made the.aws-sam
directory a symlink to../../../../
, and then all functions were built correctly.You would ask why
.aws-sam
because you have hardcoded two directories to be excluded from copying, that is.aws-sam
and.git
and if I do not call it.aws-sam
, it will create an infinite recursion :) (btw, I will be creating another ticket to allow us to extend the directories which are excluded byCustomMakeBuilder:CopySource
)Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
:SAM CLI, version 1.33.0
Add --debug flag to command you are running
The text was updated successfully, but these errors were encountered: