Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

SAM Template Schema Issue #403

Open
lazyDude71982 opened this issue Sep 26, 2021 · 5 comments
Open

SAM Template Schema Issue #403

lazyDude71982 opened this issue Sep 26, 2021 · 5 comments

Comments

@lazyDude71982
Copy link

lazyDude71982 commented Sep 26, 2021

I have found that vscode aws-toolkit uses sam schema from this repository. The extension is giving sam schema errors for

  1. No Lambda Function Event Source of tyre HttpApiEvent (so its giving error for ApiId in EventSource).
  2. Different HttpApi CorsConfiguration schema than aws docs for sam template.
@GaalDornick
Copy link
Contributor

  1. There is an API Event (https://github.com/awslabs/goformation/blob/master/cloudformation/serverless/aws-serverless-function_apievent.go). You need to specify RestApiId not ApiId
  2. Can you give an example of the CorsCOnfiguration?

@lazyDude71982
Copy link
Author

lazyDude71982 commented Oct 9, 2021

@GaalDornick

  1. The AWS docs to use ApiId when the EventSource is HttpApi.(Source)
  2. For HttpApi CorsConfiguration for AWS docs shows most of Allow* Properties of CorsConfiguration to List but schema show data type as string.
"AWS::Serverless::HttpApi.CorsConfigurationObject": {
            "additionalProperties": false,
            "properties": {
                "AllowCredentials": {
                    "type": "boolean"
                },
                "AllowHeaders": {
                    "type": "string"
                },
                "AllowMethods": {
                    "type": "string"
                },
                "AllowOrigin": {
                    "type": "string"
                },
                "ExposeHeaders": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "MaxAge": {
                    "type": "string"
                }
            },
            "type": "object"
        },

@ryan-ju
Copy link

ryan-ju commented Dec 17, 2021

This is the same issue I'm facing. Cloudformation fails to create resources.

@ryan-ju
Copy link

ryan-ju commented Dec 17, 2021

There is also a typo. Should be AllowOrigins. The current code is missing the s.

@jwarchol
Copy link

I hit this today. I manually tweaked my local sam schema to handle the lists for the allow* properties. Still trying to figure out the HttpApi ApiId issue since it seems like the AWS::Serverless::Function.EventSource part of the schema doesn't have anything for HttpApi at all. Friction like this is ☹️

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants