sam validate breaks when using Auth block under AWS::Serverless::Api
See original GitHub issueDescription
When having a template.yaml
including an Auth
property under AWS::Serverless::Api
it is invalid with a very confusing error message. If I remove this configuration the sam validate
command validates properly.
Steps to reproduce
A template.yaml
including:
...
BaseApi:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
Auth:
DefaultAuthorizer: MyAuthorizer
Authorizers:
MyAuthorizer:
FunctionArn: !GetAtt MyAuthFunction.Arn
Identity:
Header: Authorization
ValidationExpression: Bearer .*
ReauthorizeEvery: 299 # Seconds
MyAuthFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: build/
Handler: myAuthorizer.handler
...
Observed result
I skipped the --debug
flag as it might include some sensitive information and I didn’t see any valuable output there.
With Auth
config:
$ sam validate
Template provided at '/var/opt/template.yaml' was invalid SAM Template.
Error:
Without Auth
config:
$ sam validate
/var/opt/template.yaml is a valid SAM Template
Expected result
The template would be valid even with an Auth section defined.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: Linux
sam --version
: 0.13.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
sam validate breaks when using Auth block under AWS ...
When having a template.yaml including an Auth property under AWS::Serverless::Api it is invalid with a very confusing error message. If I remove ...
Read more >Validating AWS SAM template files
Validate your templates with sam validate . Currently, this command validates that the template provided is valid JSON / YAML. As with most...
Read more >Step-through debugging Lambda functions locally
To run AWS SAM in debug mode, use commands sam local invoke or sam local start-api with the --debug-port or -d option. For...
Read more >Controlling access to API Gateway APIs - AWS Documentation
AWS SAM supports several mechanisms for controlling access to your API Gateway APIs. The set of supported mechanisms differs between AWS::Serverless::HttpApi ...
Read more >Announcing nested applications for AWS SAM and the AWS ...
I can use AWS SAM to create Lambda functions, configure API Gateway, and deploy and manage them both. To start building, I can...
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
Was there a solution to this? I got the same error today:
Error: [InvalidResourceException(ManagementApi', "Invalid value for 'Auth' property")] ('ManagementApi', "Invalid value for 'Auth' property")
In my case, the issue appears when i add
UsagePlan
under theAuth
object.I am using
SAM CLI, version 0.41.0
andPython 3.7.4
sam deploy
works fine, howeverAdding
swagger: 2.0
underDefinitionBody
as mentioned in https://github.com/awslabs/aws-sam-cli/issues/803#issuecomment-616817020 does not fix anything.Any progress on this?