SAM Template Schema Issue
I have found that vscode aws-toolkit uses sam schema from this repository. The extension is giving sam schema errors for
- No Lambda Function Event Source of tyre HttpApiEvent (so its giving error for ApiId in EventSource).
- Different HttpApi CorsConfiguration schema than aws docs for sam template.
- 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
- Can you give an example of the CorsCOnfiguration?
@GaalDornick
- The AWS docs to use ApiId when the EventSource is HttpApi.(Source)
- For HttpApi CorsConfiguration for AWS docs shows most of
Allow*Properties of CorsConfiguration toListbut schema show data type asstring.
"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"
},
This is the same issue I'm facing. Cloudformation fails to create resources.
There is also a typo. Should be AllowOrigins. The current code is missing the s.
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 ☹️