question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[aws-apigateway] Creating RestApi creates default BasePathMapping preventing creation of others with addBasePathMapping

See original GitHub issue

When 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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
AlexCheemacommented, Aug 18, 2020

Also ran into this issue. Documentation is misleading.

1reaction
lzaadevcommented, Aug 13, 2020

Encountered the same issue.

| CREATE_IN_PROGRESS   | AWS::ApiGateway::BasePathMapping  | api/CustomDomain/Map:--=> default apigw base_path
| CREATE_IN_PROGRESS   | AWS::ApiGateway::BasePathMapping  | api/CustomDomain/Map:foo=> user define base_path

Maybe we can have base_path parameter in DomainNameOptions to override the default base path mapping when defining DomainName via DomainNameOptions .

Or addBasePathMapping should override the default base_path.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found