amplify-education / serverless-domain-manager

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

Error: Unable to configure ID for a Route 53 health check #504

Open epigos opened 2 years ago

epigos commented 2 years ago

Community Note

Bug Report

Error Description Error: Unable to configure ID for a Route 53 health check.

The configuration below successfully creates the health check RecordSet in AWS but serverless-domain-manager is unable to reference the ID when healthCheckId is supplied with the resource. It seems to only work when you hard-code the ID of the health check record.

Command Run e.g. sls deploy

Console Output

Environment: linux, node 16.15.1, framework 3.19.0 (local) 3.19.0v (global), plugin 6.2.2, SDK 4.3.2
Credentials: Local, environment variables
Error:
Docs:        docs.serverless.com
Error: Unable to create domain '<domain name>':
Failed to UPSERT A Alias for '<domain name>':
Support:     forum.serverless.com

[Invalid Health Check ID., Invalid Health Check ID.]

Bugs:        github.com/serverless/serverless/issues
    at ServerlessCustomDomain.<anonymous> (/home/runner/work/<repo name>/<repo name>/node_modules/serverless-domain-manager/dist/src/index.js:193:23)
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/<repo name>/<repo name>/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.


resources:
  Resources:
    myHealthCheck:
      Type: 'AWS::Route53::HealthCheck'
      Properties:
        HealthCheckConfig:
          Port: 443
          Type: HTTPS
          ResourcePath: /healthz
          FullyQualifiedDomainName: example.com
          RequestInterval: 30
          FailureThreshold: 3

custom:
  customDomain:
    domainName: example.com
    basePath: bar
    createRoute53Record: true
    route53Params:
      routingPolicy: latency
      healthCheckId: myHealthCheck  # reference myHealthCheck in resources

Versions

Possible Solution

Enable domain manager reference created resources in the customDomain config.

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

sehrish30 commented 1 year ago

Create a custom variable

healthCheckId: name: !Ref Route53HealthCheck

and then use it ${self:custom.healthCheckId.name}