Error for template created with AWS SAM
See original GitHub issuecfn-lint version: (cfn-lint --version
)
cfn-lint 0.54.2
Description of issue. Displays an error for a freshly created template using AWS SAM
Please provide as much information as possible:
- Template linting issues:
- Please provide a CloudFormation sample that generated the issue.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
sam-app
Sample SAM Template for sam-app
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 3
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: hello-world/
Handler: app.lambdaHandler
Runtime: nodejs14.x
Architectures:
- x86_64
Events:
HelloWorld:
Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /hello
Method: get
Outputs:
# ServerlessRestApi is an implicit API created out of Events key under Serverless::Function
# Find out more about other implicit resources you can reference within SAM
# https://github.com/awslabs/serverless-application-model/blob/master/docs/internals/generated_resources.rst#api
HelloWorldApi:
Description: "API Gateway endpoint URL for Prod stage for Hello World function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
HelloWorldFunction:
Description: "Hello World Lambda Function ARN"
Value: !GetAtt HelloWorldFunction.Arn
HelloWorldFunctionIamRole:
Description: "Implicit IAM Role created for Hello World function"
Value: !GetAtt HelloWorldFunctionRole.Arn
- If present, please add links to the (official) documentation for clarification.
- Validate if the issue still exists with the latest version of
cfn-lint
and/or the latest Spec files - Feature request:
- Please provide argumentation about the missing feature. Context is key! I just created a new serverless application using AWS SAM. I ran the following code:
sam init
Selected AWS Quick Start Templates
, the Zip
package type, Node14.0
as the runtime, and Hello World Example
as the application. But the linter gives the follow error:
[cfn-lint] E0001: Error transforming template: Resource with id [HelloWorldFunction] is invalid. property Architectures not defined for resource of type AWS::Serverless::Function
Cfn-lint uses the CloudFormation Resource Specifications as the base to do validation. These files are included as part of the application version. Please update to the latest version of cfn-lint
or update the spec files manually (cfn-lint -u
)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Resolve template validation or template format errors in ... - AWS
I receive an error message when I try to create my AWS CloudFormation stack. Short description. Choose one of the following solutions based...
Read more >Validating AWS SAM template files
Currently, this command validates that the template provided is valid JSON / YAML. As with most AWS SAM CLI commands, it looks for...
Read more >Resolve circular dependencies with AWS SAM templates in ...
The template produces an error because it creates the following circular dependency: The Bucket resource depends on the FunctionUploadPermission ...
Read more >AWS SAM policy templates - AWS Serverless Application Model
The AWS Serverless Application Model (AWS SAM) allows you to choose from a list of policy templates to scope the permissions of your...
Read more >Resolve the "This template does not include any resources to ...
You receive this error when you use the AWS CloudFormation console to import resources into an existing stack that was created outside of ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Believe that should be fixed by https://github.com/aws-cloudformation/cfn-lint/pull/2124 or running
cfn-lint -u
Hi @PatMyron I guess you were right that it was installed with brew.
I ran
brew uninstall cfn-lint
to remove it, and then ranpip3 install cfn-lint
to install it usingpip
. Here’s the output ofpip3 install cfn-lint
:And the good news is that the error I mentioned in the original post is gone, thought now I’m facing another one 😃 Once again this is the template.yaml (auto generated with sam init - helloworld example)
The problem displayed by
cfn-lint
: