apigateway.Resource props.parent not accepting RestAPI
See original GitHub issueThe documentation about apigateway.Resource here: https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-apigateway.Resource.html has this to say about the parent prop:
parent Type: IResource The parent resource of this resource. You can either pass another Resource object or a RestApi object here.
The last part, in bold, is the problem as it does not seem that a restapi object is being accepted.
Reproduction Steps
const myapi = new apigateway.RestApi(this, 'apigatewayApi');
const resource = new apigateway.Resource(this, 'apigatewayResourceTest', {
parent: myapi,
pathPart: 'test'
});
Error Log
(removed my local and project paths)
xxx/@aws-cdk/aws-apigateway/lib/resource.js:163
restApiId: props.parent.restApi.restApiId,
^
TypeError: Cannot read property 'restApiId' of undefined
at new Resource (xxx/@aws-cdk/aws-apigateway/lib/resource.js:163:45)
Environment
- **CLI Version :aws-cli/1.16.184 Python/3.7.3 Linux/5.0.0-32-generic botocore/1.12.174
- **Framework Version: CDK 1.14.0
- **OS : Ubuntu Linux.
- **Language :english
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top Results From Across the Web
interface RestApiProps · AWS CDK
A name for the API Gateway RestApi resource. retainDeployments? boolean, Retains old deployment resources when the API changes. apiKeySourceType? Type ...
Read more >aws ressource limit api - how to separate stacks on RestApi
Unfortunatly, creating an RestApi with fromRestApiId does return an IRestApi Object, which is not containing all necessary properties to use it ...
Read more >Data resources in UI Builder
Data resources that are made through REST API requests. Inherited versus local data resources. Inherited data resources come from the parent ...
Read more >REST API (API Gateway v1) - Serverless Framework
Serverless ships with default status codes you can use to e.g. signal that a resource could not be found (404) or that the...
Read more >Querying Azure Cosmos DB resources using the REST API
Must be set to application/query+json. Accept, Optional. At the moment, Cosmos DB always returns the response payload in standard JSON format.
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 FreeTop 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
Top GitHub Comments
parent: myapi.root
?You can also use
myapi.root.addResource('test')
see README.Might be worth thinking about updating the documentation, it’s misleading here:
https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_apigateway/ProxyResource.html