[aws-apigateway] Creating RestApi creates default BasePathMapping preventing creation of others with addBasePathMapping
See original GitHub issueWhen creating a new RestApi, when a user tries to add a domain and configure that domain according to the documentation the process will fail due to an issue with BasePathMapping (Only one base path mapping is allowed if the base path is empty). However, the user is not given an opportunity to supply a basepath for the domain before the default ‘empty’ base path is created which results in an error
Reproduction Steps
api = new apigw.LambdaRestApi( this, "proxy_api", {
handler: props.function.lambdaFn,
restApiName: 'apiname',
proxy: true,
endpointTypes: [ apigw.EndpointType.EDGE ]
} );
var domainName = this.api.addDomainName("domain_name", {
domainName: "example.com",
certificate: certificate,
endpointType: apigw.EndpointType.EDGE, // default is REGIONAL,
securityPolicy: apigw.SecurityPolicy.TLS_1_2,
});
domainName.addBasePathMapping( api, { basePath: 'foo'});
What did you expect to happen?
I expected to be able to add the basePath foo
What actually happened?
Only one base path mapping is allowed if the base path is empty. (Service: AmazonApiGateway; Status Code: 409; Error Code: ConflictException; Request ID: a2d4de69-74d0-4870-90f4-78d7d4017925)
Environment
- CLI Version :
- Framework Version: 1.57
- Node.js Version:
- OS : Windows, MacOS
- Language (Version): Typescript
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:6 (2 by maintainers)
Top Results From Across the Web
How to prevent CDK from creating default base path mapping ...
I don't want that to be created. I want to create my own base path mapping. When I add one via domain.addBasePathMapping(), I...
Read more >AWS::ApiGateway::BasePathMapping - AWS CloudFormation
The AWS::ApiGateway::BasePathMapping resource creates a base path that clients who call your API must use in the invocation URL.
Read more >@aws-cdk/aws-apigateway - npm
Configuring methodOptions on the deployOptions of RestApi will set the throttling behaviors on the default stage that is automatically created. const api =...
Read more >Amazon API Gateway - Multi level base path mapping
In this session, Don Bushell, Sr Product Manager, Amazon Serverless API Gateway joins Julian Wood to demo the new multi level base path...
Read more >aws apigateway import-rest-api - Fig.io
A feature of the API Gateway control service for creating a new API from an external API definition file.
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
Also ran into this issue. Documentation is misleading.
Encountered the same issue.
Maybe we can have
base_path
parameter inDomainNameOptions
to override the default base path mapping when definingDomainName
viaDomainNameOptions
.Or
addBasePathMapping
should override the defaultbase_path
.