template.yaml doesn't pass the sam validate
invalid YAML template: json: unsupported type: map[interface {}]interface {}
Encountered the same problem. To resolve I updated line 54:
- !Sub
+ Fn::Sub:
That ^^^ should be enough to pass sam validate.
Next I tried running sam local start-api but was stopped by:
Cannot parse Swagger definition: json: cannot unmarshal number into Go struct field SwaggerProps.swagger of type string
To resolve this one I updated the swagger version field on line 92 from a number to a string:
- swagger: 2.0
+ swagger: "2.0"
I can now start the test environment, but I'm unable to successfully hit the endpoint. When I try to load/curl http://localhost:3000 I get:
{ "message": "No function defined for resource method" }
The "No function defined..." issue was also reported here: https://github.com/awslabs/aws-sam-local/issues/289
Replacing the ANY http method with GET and POST handlers solves all example cases from the README:
Events:
GetRequest:
Type: Api
Properties:
Path: /
Method: GET
RestApiId: !Ref ExampleAPI
PostRequest:
Type: Api
Properties:
Path: /
Method: POST
RestApiId: !Ref ExampleAPI