-
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
The resource AWS::Lambda::Function 'xxx4FF3C67E' has specified S3 location for Code. It will not be built and SAM CLI does not support invoking it locally. #2802
Comments
This is the expected behavior, if a lambda function's |
@aahung |
@lidong-jimi Are you by chance using CDK to generate a template to test locally with? |
@lidong-jimi or is the template the output of |
@jfuss @aahung My workflow:
Generate template.yaml:
In this case, sam local start-api cannot be used if delete:
In this case, sam local start-api can be used |
@lidong-jimi Thanks for reporting. This is unexpected behavior. I think this was introduced in #2756. Let me dig a little further but what I think is happening is we are validating S3 uri/objects before resolving the Metadata. It is true that we cannot run locally if the CodeUri is S3 but with CDK, the generated output places some keys in the Metadata section that SAM CLI uses to resolve where the local assets are. I will report back here once I confirm what exactly is happening. |
@lidong-jimi So looking at the CDK output, there are pieces of information that CDK is not generating at all. There should be CDK has a walk through of this here: https://docs.aws.amazon.com/cdk/latest/guide/sam.html Have you followed this? From what I can tell, we are solving things correctly (just parsing the code). I am trying to setup cdk locally myself but currently node on my machine is all messed up. |
Following the docs I linked above, I get the following resources generated by CDK:
This template does local invoke correctly by doing |
@jfuss |
@jfuss CDK:
Generate template.yaml:
valcheck file:
When sam local invoke valcheckF73A144E:
Do you need to configure other options? |
@lidong-jimi Something is wrong with how you have setup the code. The asset is the root of the files for the lambda function. So |
I would like to point out that this worked in 1.15.0 and it was a vital part of my workflow, hence SAM CLI is broken for me now and I need to create a dedicated SAM template in addition to my CF templates or what is the workaround since the functionality is removed? Any recommendations are highly appreciated. See my issue #2825 |
Description:
The resource AWS::Lambda::Function 'xxx4FF3C67E' has specified S3 location for Code. It will not be built and SAM CLI does not support invoking it locally.
Steps to reproduce:
When run
**sam local start-api**
.output:
Observed result:
Expected result:
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 1.22.0Add --debug flag to command you are running
The text was updated successfully, but these errors were encountered: