Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple api mappings on same domain name do not work (takes latest) #522

Open
evdh opened this issue Oct 28, 2022 · 2 comments
Open

Multiple api mappings on same domain name do not work (takes latest) #522

evdh opened this issue Oct 28, 2022 · 2 comments
Labels

Comments

@evdh
Copy link

evdh commented Oct 28, 2022

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Bug Report

Error Description
I want to have multiple api mappings on the same domain name pointing to the same API stage. Although no errors are shown, only the last of the 2 entries is actually applied and not the first one. If I switch around the 2 configurations in the array, the last one again is chosen.

Command Run
'sls deploy'

Console Output

  Domain Name: test.mydomain.com
  Target Domain: d-5ivgybpoiu.execute-api.eu-central-1.amazonaws.com
  Hosted Zone Id: Z1U9ULNL0V5BC7
  Domain Name: sandbox.api.bittiq.cloud
  Target Domain: d-5ivgybpoiu.execute-api.eu-central-1.amazonaws.com
  Hosted Zone Id: Z1U9ULNL0V5BC7

Domain Manager Configuration
Replace this with your own serverless.yml file (anonymized, of course) to help us better resolve your issue.

custom:
  customDomains:
    - rest:
        domainName: test.mydomain.com
        basePath: v1
        stage: dev
        createRoute53Record: true
        securityPolicy: tls_1_2
        endpointType: regional
        certificateName: '*.mydomain.com'
    - rest:
        domainName: test.mydomain.com
        basePath: v2
        stage: dev
        createRoute53Record: true
        securityPolicy: tls_1_2
        endpointType: regional
        certificateName: '*.mydomain.com'

Versions

  • Domain Manager version(s): 6.1.0
  • Node/npm version: Node 15 / Npm 6.14
  • Serverless Version: 3.23
  • Lambda Code: Javascript

Possible Solution

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.

@evdh evdh added the bug label Oct 28, 2022
@j1-uli-holtel
Copy link

I ran into exactly the same issue. Although I fixed it temporarily on a local branch by changing the logic in setupBasePathMappings, I don't think it is the right solution to the problem, because tasks like 'create_domain' will try to create the domain multiple times which obviously results in errors.

Instead I propose that basePath, or basePaths for that matter, accepts a list of mappings.

custom:
  customDomains:
    - rest:
        domainName: test.mydomain.com
        basePaths:
          - v1
          - v2
        stage: dev
        createRoute53Record: true
        securityPolicy: tls_1_2
        endpointType: regional
        certificateName: '*.mydomain.com'

Now that I know the code a little bit better I am happy to work on a fix for it.

@rddimon
Copy link
Collaborator

rddimon commented Feb 13, 2024

Hi there

Hope you are doing well and the issue is solved, but ...

Do you @evdh @j1-uli-holtel still see this issue with the v7.3.5 version?

If it is still a case, could you please provide more info?

  1. is it for the same domain name? As in the Console Output I see 2 different domains and in the yml config 2 same
  2. What is the function(s) event type? Could you please provide the function config example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants