A number of issues with SAM template for Cognito Authorizer
In my SAM template, I need to setup Cognito User Pools Authorizer for my Api gateway. I'm trying to follow this example. However, from the beginning, I encountered error. Firstly I run the dependencies (on root folder):
npm install . --prefix ./src
Then replaced variables S3_BUCKET_NAME and STACK_NAME with some string values (I'm using command line and to prevent any mistake, I put actual value instead of a variable). But then I can't package the application. I run following command:
aws cloudformation package --template-file template.yaml --output-template-file template.packaged.yaml --s3-bucket our-sam-apps
and get this error (without changing the template):
Unable to upload artifact ./src referenced by CodeUri parameter of MyFunction resource. [WinError 3] The system cannot find the path specified: 'C:\my_path_in_wondows\api_cognito_auth\src\node_modules\api_cognito_auth\src\node_modules\api_cognito_auth\src\node_modules\api_cognito_auth\src\node_modules\api_cognito_auth\node_modules\clean-css\lib\optimizer\level-2\properties\is-mergeable-shorthand.js'
Anyway, I could bypass this issue by copy pasting parts of my template to an existing application and it works there (I'm really confused why it doesn't work on the original app). Then I validate the template and get this error:
sam validate
Template provided at 'C:\my_path_in_windows\template.yaml' was invalid SAM Template. Error: [InvalidResourceException('MyApi', "Cors works only with inline Swagger specified in 'DefinitionBody' property")] ('MyApi', "Cors works only with inline Swagger specified in 'DefinitionBody' property")
According to SAM doc, I should provide Swagger doc, otherwise it will create a default for me. So what's thep roblem? Also, I'm wondering what's the need for Swagger file when api routes etc are defined within the template?
Can you please help me to setup application? Thanks
this issue is related to https://github.com/awslabs/aws-sam-cli/issues/803
sam validate does not currently support the auth object, continue to validate with cloudformation cli instead...
Closing due to age. If there is still something you need help with, please create a new issue.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.