You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sam validate breaks when using Auth block under AWS::Serverless::Api #1074
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.
@terlar This is an error with your template. I get [InvalidResourceException('BaseApi', "Auth works only with inline Swagger specified in 'DefinitionBody' property")] ('BaseApi', "Auth works only with inline Swagger specified in 'DefinitionBody' property") when I run validate with the above template.
Side note: You should install in Python3.6+ so you can see the errors with validate instead of the Error: with no additional details.
Closing as the definition is not correct and validate is working as expected.
Interesting, because I have successfully deployed this template and are using the Auth block. Thank you for the feedback regarding Python 3.6+ I wasn't aware. I will investigate further.
I now see errors with python 3, and it makes sense. Is it planned to have support for Auth without using inline Swagger? And perhaps the most interesting is it unintentional that it actually works when you do it this way?
Yes this should be fixed in our validate command. Would you be up for submitting a patch for it? I think our check here needs a small adjustment, plus updating/new tests.
Thanks for providing the hints where to look, I might be able to do it. If I don't manage to do it today, it will take at least another week until I can take a look at it. But I will give it a shot.
Activity
jfuss commentedon Mar 22, 2019
@terlar This is an error with your template. I get
[InvalidResourceException('BaseApi', "Auth works only with inline Swagger specified in 'DefinitionBody' property")] ('BaseApi', "Auth works only with inline Swagger specified in 'DefinitionBody' property")when I run validate with the above template.Side note: You should install in Python3.6+ so you can see the errors with validate instead of the
Error:with no additional details.Closing as the definition is not correct and validate is working as expected.
Update:
This is actually a duplicate of #803
terlar commentedon Mar 22, 2019
Interesting, because I have successfully deployed this template and are using the
Authblock. Thank you for the feedback regarding Python 3.6+ I wasn't aware. I will investigate further.terlar commentedon Mar 22, 2019
I now see errors with python 3, and it makes sense. Is it planned to have support for
Authwithout using inline Swagger? And perhaps the most interesting is it unintentional that it actually works when you do it this way?terlar commentedon Mar 22, 2019
Seems like this has been discovered before:
It is supported by SAM and thus works with the sam package/deploy, but not the
sam validate. I still believe it should be fixed in the validator.terlar commentedon Mar 22, 2019
However there is already a ticket for it: #803
jfuss commentedon Mar 22, 2019
Ahh. It's that...
Yes this should be fixed in our validate command. Would you be up for submitting a patch for it? I think our check here needs a small adjustment, plus updating/new tests.
terlar commentedon Mar 22, 2019
Thanks for providing the hints where to look, I might be able to do it. If I don't manage to do it today, it will take at least another week until I can take a look at it. But I will give it a shot.
jackmcguire1 commentedon Apr 27, 2019
Any progress on this?
piersf commentedon Apr 27, 2020
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
UsagePlanunder theAuthobject.I am using
SAM CLI, version 0.41.0andPython 3.7.4sam deployworks fine, howeverAdding
swagger: 2.0underDefinitionBodyas mentioned in #803 (comment) does not fix anything.