amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.
MIT License
941 stars 232 forks source link

Error: Unable to setup base domain mappings for DOMAIN #544

Closed kaotu closed 1 year ago

kaotu commented 1 year ago

Community Note

Bug Report

Error Description Unable to use getApiMappings function in ap-southeast-3 (Jakarta region) because this function had used the apiGatewayV2. Link issue #537

Command Run

sls deploy --stage <stage> --region ap-southeast-3

Console Output

Error: Unable to setup base domain mappings for '<DOMAIN>':
Make sure the '<DOMAIN>' exists. Unable to get API Mappings:
Bad Request
    at ServerlessCustomDomain.<anonymous> (/Users/<USER>/<Project>/<Service>/node_modules/serverless-domain-manager/dist/src/index.js:294:27)
    at Generator.throw (<anonymous>)
    at rejected (/Users/<USER>/<Project>/<Service>/node_modules/serverless-domain-manager/dist/src/index.js:6:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

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

custom:
  customDomain:
    domainName: ${self:provider.domain}
    hostedZoneId: ${self:provider.hostzoneid}
    basePath: ''
    certificateArn: ${self:provider.certificatearn}
    stage: ${self:provider.stage}
    createRoute53Record: true
    endpointType: EDGE
    securityPolicy: TLS_1_0
    autoDomain: true

provider:
  name: aws
  runtime: python3.8
  memorySize: 128
  domain: <$DOMAIN>
  hostzoneid: <$HOSTZONE_ID>
  certificatearn: <$CERT_ARN_JAKARTA_REGION>
  stage: staging
  region: ${opt:region, 'ap-southeast-3'}

Versions

Possible Solution

We will add a parameter for defines the api gateway version, which accepts v1 or v2. The default is v2.

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

andersrrm commented 1 year ago

I have the same issue

varad11 commented 1 year ago

I am getting the following error:

Error:

Unable to create base path mapping for '': Invalid stage identifier specified

I am setting the following config:

customDomain:
    domainName: ${self:custom.domainName}
    basePath: ""
    certificateName: ${self:custom.domainCert}
    createRoute53Record: true
    stage: ${opt:stage, "test"}
    endpointType: 'regional'
    apiType: http

//TEMPORARY WORKAROUND I have downgraded this dependency to v6.2.1 in my project. And it's working perfectly fine now.

rddimon commented 1 year ago

I am getting the following error:

Error:

Unable to create base path mapping for '': Invalid stage identifier specified

I am setting the following config:

customDomain:
    domainName: ${self:custom.domainName}
    basePath: ""
    certificateName: ${self:custom.domainCert}
    createRoute53Record: true
    stage: ${opt:stage, "test"}
    endpointType: 'regional'
    apiType: http

//TEMPORARY WORKAROUND I have downgraded this dependency to v6.2.1 in my project. And it's working perfectly fine now.

Hi @varad11

You need to remove the stage option from the customDomain config The stage value will be inherited from the serverless options or service.provider.stage here is a code

In the latest release we added support for the custom stage for HTTP API

In the AWS documentation it's no clear how it should work As I see that feature will cause more problems then help here so we may need to revert changes

varad11 commented 1 year ago

Hi @rddimon, Checked the latest version. That particular error is not reoccurring. Also I didn't remove the "stage" field in customDomain. Thanks for the prompt changes and release.