sam validate gives empty error
See original GitHub issueDescription:
I created a SAM template and wanted to validate it, which led to an undefined error.
The question about what is wrong with the template is a general help question, but I still think that the validator shouldn’t answer with empty error messages.
Steps to reproduce the issue:
- Create
template.yaml
- Run
sam validate
Observed result:
2019-06-05 15:40:48 Found credentials in shared credentials file: ~/.aws/credentials
Template provided at '/home/ec2-user/environment/serverless-api/template.yaml' was invalid SAM Template.
Error:
Expected result:
Some error that tells me what I did wrong.
This was the template I created:
AWSTemplateFormatVersion: "2010-09-09"
Transform: "AWS::Serverless-2016-10-31"
Description: "A example REST API build with serverless technology"
Globals:
Function:
Runtime: nodejs8.10
Handler: index.handler
Tags:
Application: Serverless API
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Cors: "'*'"
Auth:
DefaultAuthorizer: CognitoAuthorizer
Authorizers:
CognitoAuthorizer:
UserPoolArn: !GetAtt UserPool.Arn
IndexFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: functions/index/
Events:
Home:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /
Method: GET
Auth:
Authorizer: NONE
ImageFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: functions/images/
Events:
ListImages:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /images
Method: GET
DeleteImage:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /images/{imageId}
Method: DELETE
CreateImage:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /images
Method: POST
TagsFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: functions/tags/
Events:
ListTags:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /tags
Method: GET
ListImages:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /tags/{tagId}/images
Method: GET
AuthFunction:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
USER_POOL_CLIENT_ID: !Ref UserPoolClient
Events:
Signup:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /signup
Method: POST
Auth:
Authorizer: NONE
Signin:
Type: Api
Properties:
RestApiId: !Ref MyApi
Path: /signin
Method: POST
Auth:
Authorizer: NONE
PreSignupFunction:
Type: AWS::Serverless::Function
Properties:
InlineCode: |
exports.handler = async event => {
event.response = { autoConfirmUser: true };
return event;
};
UserPool:
Type: AWS::Cognito::UserPool
Properties:
UserPoolName: ApiUserPool
LambdaConfig:
PreSignUp: !GetAtt PreSignupFunction.Arn
Policies:
PasswordPolicy:
MinimumLength: 6
UsernameAttributes:
- email
Schema:
- AttributeDataType: String
Name: email
Required: no
UserPoolClient:
Type: AWS::Cognito::UserPoolClient
Properties:
UserPoolId: !Ref UserPool
ClientName: ApiUserPoolClient
GenerateSecret: no
LambdaCognitoUserPoolExecutionPermission:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName: !GetAtt PreSignupFunction.Arn
Principal: cognito-idp.amazonaws.com
SourceArn: !Sub 'arn:${AWS::Partition}:cognito-idp:${AWS::Region}:${AWS::AccountId}:userpool/${UserPool}'
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Lambda SAM deploy giving error 'EC2DescribePolicy' at ...
If a policy template does not require any placeholder values, you must specify an empty object. So you should have:
Read more >sam deploy - AWS Serverless Application Model
To deploy an AWS SAM application, use the sam deploy command from the AWS SAM CLI. ... then the operation returns an InsufficientCapabilities...
Read more >Errors in SAM or BAM files can be diagnosed with ... - GATK
Invalid SAM/BAM files generally have one or more errors in the following ... To be clear, here we focus on diagnostics, not treatment....
Read more >Encountering Error Messages | GRANTS.GOV
Incompatible Version of Adobe; Schema Validation Error; File Damaged and Cannot Be Repaired; Error: org.xml.sax.SAXParseException.
Read more >BamUtil: validate - Genome Analysis Wiki
If you want to see the error details, use --verbose, but if you want to limit the number of errors displayed, use --printableErrors....
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
@kay-is see #803
@kay-is Please install SAM CLI in Python3.6 or Python3.7. See this comment on the issue.
Closing as the path forward is to install in Python3 instead of Py2.