question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AWS::Serverless::Function CodeUri no longer supports Files

See original GitHub issue

Description:

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)

  1. OS: MacOS Big Sur 11.2.2
  2. sam --version: 1.2
  3. 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:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mfriesencommented, Mar 10, 2021

@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.

0reactions
aahungcommented, Mar 11, 2021

I am gonna close this issue since the main problem is a duplicate of #2692. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS::Serverless::Function CodeUri with Ref not working ...
In this case I use aws deploy command without passing any parameters => stack creation should have used hardcoded parameter value from ...
Read more >
Function - AWS Serverless Application Model
Creates an AWS Lambda function, an AWS Identity and Access Management (IAM) execution role, and event source mappings that trigger the function.
Read more >
Unable to build a python app with AWS SAM - Stack Overflow
python3.9 is not supported. The supported runtimes are listed here and the latest python that you can use is python3.8 . SAM supports...
Read more >
GLIBC not found with AWS SAM and Golang - Matt Gaunt
The go.mod file is at the root of the project allowing my Lambda functions to ... Type: AWS::Serverless::Function Properties: CodeUri: ...
Read more >
Testing Lambdas locally with aws-sam-cli
You use an AWS SAM template file to operate on a single, ... /2016-10-31.md#awsserverlessfunction; Properties: CodeUri: hello-world/ .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found