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

How to deploy a custom domain created in other region?

Open sleiter88 opened this issue 3 years ago • 1 comments
trafficstars

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

Support Question

Question I have all my serverless services in eu-west-1 but I need to migrate one service to us-west-1 so i remove it from eu-west-1 and then I try to deploy it in the new region but I receive the following error: TypeError: Cannot read property 'domainName' of undefined so i suppose the new region needs a "create_domain" command to configure it in that region. But when I execute the "create_domain" command I receive the following error: Error: Error: Unable to create domain myapi.domain.com so I thinks is about the domain already exists in other region but I don't know how to use it in us-west-1

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

customDomain:
    domainName: ${self:custom.domain.${opt:stage}}
    basePath: ${self:service}
    stage: ${self:custom.stage}
    createRoute53Record: true
    route53Params:
      routingPolicy: latency

Versions

  • Domain Manager version(s): v4.2.0
  • Node/npm version: v14.2.0
  • Serverless Version: v1.83.3
  • Lambda Code: Python

sleiter88 avatar Apr 08 '22 17:04 sleiter88

It looks like if you want to used a specific region for your certificate you need to use endpointType: 'regional'. This is because the default edge endpoint type uses a CloudFront distribution which can only support certificates for the us-east-1 region.

So by specifying the 'regional' endpoint type this plugin will assume your certificate is within the region specified in provider.region in your serverless.yml file. Obviously you will want to make sure that the regional endpoint type is appropriate for your needs. In my case I am not expecting any API traffic from outside of that region so it will work just fine. But if you are expecting global traffic to your API you will want to stick with edge and create your cert in the us-east-1 region. It is kind of a pain, but it is an AWS limitation not a Serverless or serverless-domain-manager limitation. If you want to use CloudFront for anything else you are going to run into the same limitation.

ajmichels avatar May 26 '22 14:05 ajmichels

Hi @sleiter88

Hope you have solved this issue. It looks like you have a solution in the comment above.

Also, we are not supporting 4.x anymore please try our latest version 6.x and let us know in case of any issues

rddimon avatar Feb 06 '23 21:02 rddimon