AWS::Serverless::Function CodeUri no longer supports Files
See original GitHub issueDescription:
Previous to sam-cli 1.2 you could specify a ZIP file in the CodeUri parameter. Now receiving error that the path in the CodeUri must be a directory.
Lambda: Type: AWS::Serverless::Function Properties: Handler: test.LambdaRuntime Runtime: provided CodeUri: ./lambda.zip
Steps to reproduce:
Create a lambda compatible zip file and specify the zip file in the CodeUri: parameter
Observed result:
Receive error that sam cli expects the ./lambda.zip file to be a directory.
Error: CustomMakeBuilder:CopySource - [Errno 20] Not a directory:
Expected result:
I expect the ‘sam build’ command to completely successfully like v1.19.1 did.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: MacOS Big Sur 11.2.2
sam --version
: 1.2- AWS region: us-east-1
Add --debug flag to command you are running
2021-03-06 12:28:26,851 | Building codeuri: formkiq-pro/storage/lambda-s3-graalvm.zip runtime: provided metadata: {} functions: [‘FormKiQ/CoreStorage/StagingS3Create’, ‘FormKiQ/CoreStorage/DocumentsS3Update’]
2021-03-06 12:28:26,851 | Building to following folder /Users/slycer/Documents/workspace/java/24hourwebhook/api/.aws-sam/build/FormKiQ/CoreStorage/StagingS3Create
2021-03-06 12:28:26,854 | Loading workflow module ‘aws_lambda_builders.workflows’
2021-03-06 12:28:26,855 | Found workflow ‘CustomMakeBuilder’ to support capabilities ‘Capability(language=‘provided’, dependency_manager=None, application_framework=None)’
2021-03-06 12:28:26,857 | Running workflow ‘CustomMakeBuilder’
2021-03-06 12:28:26,857 | Running CustomMakeBuilder:CopySource
2021-03-06 12:28:26,857 | CustomMakeBuilder:CopySource raised unhandled exception
Traceback (most recent call last):
File “/usr/local/Cellar/aws-sam-cli/1.20.0/libexec/lib/python3.8/site-packages/aws_lambda_builders/workflow.py”, line 269, in run
action.execute()
File “/usr/local/Cellar/aws-sam-cli/1.20.0/libexec/lib/python3.8/site-packages/aws_lambda_builders/actions.py”, line 101, in execute
copytree(self.source_dir, self.dest_dir, ignore=shutil.ignore_patterns(*self.excludes))
File “/usr/local/Cellar/aws-sam-cli/1.20.0/libexec/lib/python3.8/site-packages/aws_lambda_builders/utils.py”, line 43, in copytree
names = os.listdir(source)
NotADirectoryError: [Errno 20] Not a directory: ‘/Users/slycer/Documents/workspace/java/24hourwebhook/api/formkiq-pro/storage/lambda-s3-graalvm.zip’
2021-03-06 12:28:26,862 | Sending Telemetry: {‘metrics’: [{‘commandRun’: {‘requestId’: ‘0dce9063-0ccb-48ea-acbe-360e332be720’, ‘installationId’: ‘0b808f24-f70f-4bda-bc67-f2f6e75a8977’, ‘sessionId’: ‘e4b71770-8c76-4b67-ad33-7d78c71afab2’, ‘executionEnvironment’: ‘CLI’, ‘pyversion’: ‘3.8.8’, ‘samcliVersion’: ‘1.20.0’, ‘awsProfileProvided’: False, ‘debugFlagProvided’: True, ‘region’: ‘’, ‘commandName’: ‘sam build’, ‘duration’: 59782, ‘exitReason’: ‘WorkflowUnknownError’, ‘exitCode’: 1}}]}
2021-03-06 12:28:27,158 | Telemetry response: 200
Error: CustomMakeBuilder:CopySource - [Errno 20] Not a directory: ‘/Users/slycer/Documents/workspace/java/24hourwebhook/api/formkiq-pro/storage/lambda-s3-graalvm.zip’
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
@aahung You can see the whole project and directory structure at https://github.com/formkiq/formkiq-core/releases/download/v1.2.8/formkiq-core-1.2.8.zip.
My build process is completely independent of SAM build. I use SAM as a tool to deploy applications to AWS and not a build tool. This allows me to take a number of separate components and combine them into 1 application / cloudformation template.
I am gonna close this issue since the main problem is a duplicate of #2692. Thanks!