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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to map domain to WS API when both REST and WS APIs are defined externally #366

Closed
dankochetov opened this issue Jul 14, 2020 · 2 comments · Fixed by #398
Closed
Labels

Comments

@dankochetov
Copy link

dankochetov commented Jul 14, 2020

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
When both provider.apiGateway.restApiId and provider.apiGateway.websocketApiId are set and custom domains are required for both, the plugin maps both rest and websocket domains to the REST API.

Domain Manager Configuration

provider:
  apiGateway:
    restApiId: <id>
    restApiRootResourceId: <id>
    websocketApiId: <id>

custom:
  customDomain:
    rest:
      domainName: foo.api.bar.tld
      certificateArn: ${env:API_DOMAIN_CERTIFICATE_ARN}
      basePath: foo
      endpointType: edge
    websocket:
      domainName: foo.ws-api.bar.tld
      basePath: foo
      endpointType: regional

Versions

  • Domain Manager version(s): 4.1.1
  • Node/npm version: Node 10.20.1/npm 6.14.4
  • Serverless Version: 1.69.0
  • Lambda Code: JS

Possible Solution
This line is probably causing the issue:

if (this.serverless.service.provider.apiGateway && this.serverless.service.provider.apiGateway.restApiId) {

It always returns the REST API ID when it's set and doesn't check if we're actually looking for the WS API ID.

@RickMeasham
Copy link

There are quite a number of issues with the getApiId function. A band-aid fix for all of them might be to include the ability to set it in the customDomain clause (using refs or functions or strings)

@okgolove
Copy link

okgolove commented Sep 22, 2020

Facing the same issue.

It is not necessary to specify external websocketApiId. Even Cloudformation creates a websocket api gw by itself a domain is mapped to a rest api gw.

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