serverless-domain-manager icon indicating copy to clipboard operation
serverless-domain-manager copied to clipboard

Serverless domain manager incorrectly inferring api gateway stage name

Open sam-higton opened this issue 4 years ago • 3 comments

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 attempting to deploy a serverless stage that has a domain, it incorrectly infers the Api gateway name as my-application-stage whereas serverless has created the api gateway as stage-my-application. This results in an error as Serverless Domain Manager cannot find the api gateway in the cloudformation.

Command Run sls deploy --stage staging

Console Output

Serverless Domain Manager: Error:  Error: Failed to find CloudFormation resources with an error: ValidationError: Resource ApiGatewayRestApi does not exist for stack my-application-staging

Serverless Domain Manager: Error: my-application-staging.domain.com:  Error: Failed to find a stack my-application-staging

Serverless Domain Manager: Error: my-application-staging.domain.com:  Error: Failed to find CloudFormation resources for my-application-staging.domain.com

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

custom:
  stage: ${opt:stage, self:provider.stage}
  domains:
    prod: my-application.domain.com
    staging: my-application-staging.domain.com
    dev: my-application-dev.domain.com

  customDomain:
    basePath: ""
    domainName: ${self:custom.domains.${self:custom.stage}}
    stage: "${self:custom.stage}"
    createRoute53Record: true
    certificateArn: <certificate-arn-here>

Versions

  • Domain Manager version(s): 5.0.0
  • Node/npm version: Node 12.7.0/npm 6.10.0
  • Serverless Version: 2.3.0
  • Lambda Code: Javascript

sam-higton avatar Oct 29 '20 14:10 sam-higton

image I also have the same issue when trying to deploy with httpApi config

linrium avatar Jan 19 '21 14:01 linrium

Workaround is to delete stage field from customDomain

apnordcloud avatar Jan 27 '21 17:01 apnordcloud

In my case the issue was that I was using a wrong apiType. The default is rest but my api was using http. So after changing it

apiType: http

it worked like charm

defko avatar Nov 11 '21 20:11 defko

Hi @sam-higton

Hope you have solved this issue.

We are not supporting 5.x any more please try our latest version 6.x and let us know in case of any issues

rddimon avatar Feb 06 '23 21:02 rddimon