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

Wrongly attempts to make APIGatewayV2 domain for a V1 rest api

Open kferrone opened this issue 4 months ago • 1 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 Wrongly attempts to make APIGatewayV2 domain for a V1 rest api. The api gateway created by serverless is for sure a REST api with EDGE endpoint type.

Command Run e.g. sls deploy, sls create_domain, etc.

Happens when deploy or create_domain and the same exact error will occur.

Console Output

✖ Stack the-app-dev01 failed to deploy (4s)


✖ Error: Unable to create domain 'patient-dev01.example.com':
V2 - Failed to create custom domain 'patient-dev01.example.com':
EDGE endpoint type is not supported for APIGatewayV2 domainName
    at ServerlessCustomDomain.<anonymous> (/Users/me/workspaces/them/functions/the-app/node_modules/serverless-domain-manager/dist/src/index.js:253:23)
    at Generator.throw (<anonymous>)
    at rejected (/Users/me/workspaces/them/functions/the-app/node_modules/serverless-domain-manager/dist/src/index.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

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

provider:
  name: aws
  runtime: nodejs20.x
  timeout: 30  
  stage: dev01
  region: us-west-2
  apiName: foobar-dev01-patient
  endpointType: EDGE
  environment:
    NODE_ENV: foobar-${opt:stage}-env
    NODE_PATH: "/var/task/src/"
  iam:
    role: arn:aws:iam::${aws:accountId}:role/foobar-${opt:stage}
  vpc:
    securityGroupIds: 
      "Fn::Split":
        - ","
        - ${ssm:/${opt:stage}/security-groups}
    subnetIds: 
      "Fn::Split":
        - ","
        - ${ssm:/${opt:stage}/private-subnets}
custom:
  customDomain:
    domainName: patient-${opt:stage}.${ssm:/${opt:stage}/domain-suffix}
    basePath: '/'
    stage: ${opt:stage}
    createRoute53Record: true
    apiType: rest # shouldn't this be enough to tell it's a v1 rest api?
    endpointType: EDGE
    securityPolicy: TLS_1_2
    certificateName: "*.${ssm:/${opt:stage}/domain-suffix}"
    hostedZoneName: ${ssm:/${opt:stage}/domain-suffix}
    autoDomain: true

Versions

  • Domain Manager version(s): 7.4.0
  • Node/npm version: v20.12.1
  • Serverless Version: v4.4.4
  • Lambda Code: NodeJS

Possible Solution

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

Created a cert of type RSA in us-east-1. The sls app already existed before adding this plugin. I verified the actual api gateway is created as an REST with edge endpoint. The route53 record, in our case, absolutely must be an Alias A record, if cname then some automation will swiftly delete it.

kferrone avatar Oct 04 '24 18:10 kferrone