Linting exception for valid SAM Api resource
See original GitHub issuecfn-lint version: 0.27.1
Description of issue
RestApiId
is not recognised as a valid type for type AWS::Serverless::Function
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Description: The cloudformation includes all lambda definitions.
Globals:
Function:
Runtime: go1.x
Timeout: 5
Handler: main
Parameters:
AllowedCORSDomain:
Type: String
ParentStackName:
Type: String
ApiGatewayStageName:
Type: String
StripePrivateKey:
Type: String
Resources:
HelloWorldFunction:
Properties:
CodeUri: ../go/lambda/hello-world/
Events:
Api:
Properties:
Method: Get
Path: /
RestApiId:
Ref: ApiGateway
Type: Api
FunctionName: Hello-world
Type: AWS::Serverless::Function
ApiGateway:
Properties:
Cors:
AllowMethods: "'OPTIONS,POST,GET'"
AllowHeaders: "'Content-Type'"
AllowOrigin: !Ref AllowedCORSDomain
DefinitionBody:
openapi: '3.0'
bathPath: /
schemes:
- https
paths:
/hello:
get:
responses:
'200': {}
x-amazon-apigateway-integration:
type: 'aws_proxy'
httpMethod: 'POST'
uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HelloWorldFunction.Arn}/invocations
MethodSettings:
- DataTraceEnabled: true
HttpMethod: "*"
LoggingLevel: INFO
MetricsEnabled: true
ResourcePath: /*
Name: Hello-world-ApiGateway
OpenApiVersion: '2.0'
StageName: dev
Type: AWS::Serverless::Api
The way of setting APIGateway comes from aws document.
Error:
Error transforming template: unhashable type: 'dict_node' [E0001].
If comment out RestApiId: !Ref ApiGateway
, then works.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Linting exception for valid SAM Api resource #1325 - GitHub
The way of setting APIGateway comes from aws document. Error: Error transforming template: unhashable type: 'dict_node' [E0001].
Read more >Validating AWS SAM template files
Validate your templates with sam validate . Currently, this command validates that the template provided is valid JSON / YAML. As with most...
Read more >What causes my SAM template to generate that many errors
I am able to do GET requests, but CORS is preventing me from doing the PUT and POST requests. What is redundant and...
Read more >Deploy a serverless API using lambda with SAM CLI and a ...
SAM Cli uses a swagger file to configure the Gateway API, an interface ... COLOR_BGR2RGB) res.append(infer_func(img)) except Exception as e: ...
Read more >Top 10 Serverless Deployment Errors (and How to Fix Them)
The CloudFormation stack is in an invalid state for preparation ... This error is caused when creating a API Gateway resource with a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kddejong
aws-sam-translator
version is1.20.1
Sorry, I updated the template. so now, you should see the error, and if I comment out
or
FunctionName: Hello-world
, then it will work@JustinLiang90 can you do a
pip list
and tell me what version ofaws-sam-translator
you have?E0001
on a SAM translator are the result of us getting an error back from that package. I haven’t been able to replicate the issue so I’m wondering if you have a different version of that package than I do.