amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

v7.0.2 sls create_domain fails

CodeZeno opened this issue Β· comments

commented

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
I was receiving an error in v6.4.4 about the stack not being found so updated to v7.0.2, I cleared everything and try to start from scratch. But this plugin is unable to see my certificate which I have created in both us-east-1 and ap-southeast-2.

Command Run
sls create_domain --verbose --aws-profile codezeno (usually the profile is picked up from serverless.yml > provider.profile but I wanted to make sure)

Console Output

C:\work\projects\api>sls create_domain --verbose --aws-profile codezeno
Running "serverless" from node_modules
V2 - 'staging-api.mycustomdomain.com' does not exist.
Searching for a certificate with the '*.mycustomdomain.com' domain
Environment: win32, node 18.14.0, framework 3.30.1 (local) 3.28.1v (global), plugin 6.2.3, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: Unable to create domain 'staging-api.mycustomdomain.com':
Could not find an in-date certificate for '*.mycustomdomain.com'.
    at ServerlessCustomDomain.<anonymous> (C:\work\projects\api\node_modules\serverless-domain-manager\dist\src\index.js:228:23)
    at Generator.throw (<anonymous>)
    at rejected (C:\work\projects\api\node_modules\serverless-domain-manager\dist\src\index.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Domain Manager Configuration

service: codezeno-api
frameworkVersion: '3'

provider:
  name: aws
  profile: codezeno
  runtime: nodejs18.x
  stage: v1
  region: ap-southeast-2
  endpointType: REGIONAL
  memorySize: 256
  timeout: 10

package:
  patterns:
    - '!*.cmd'

functions:
  Codezeno:
    handler: handler.codezeno
    name: Codezeno-API
    description: 'Codezeno API'
    events:
      - http:
          path: v1/auth
          method: post
          cors: true
      - http:
          path: v1/reauth
          method: post
          cors: true
      - http:
          path: v1/user/rewards
          method: get
          cors: true

plugins:
  - serverless-domain-manager

custom:
  customDomain:
    domainName: staging-api.mycustomdomain.com
    basePath: ""
    stage: ${self:provider.stage}
    certificateName: '*.mycustomdomain.com'
    createRoute53Record: true
    createRoute53IPv6Record: true
    endpointType: regional
    securityPolicy: tls_1_2
    apiType: http

Versions

  • Domain Manager version(s): v7.0.2
  • Node/npm version: v18.14.0/v9.4.2
  • Serverless Version: v3.30.1
  • Lambda Code: Javascript

Possible Solution
It certainly seems like credentials or permission issues as the certificates exists and are valid

Additional context/Screenshots
In version 6.4.4 I had errors about the cloud formation stack not being found however it would still work as if it could find it.

I have a similar issue here with version 7.0.2. In my ~/.aws/credentials I added a line region=us-east-1 but this did not resolve the problem. I do not have the environment variable AWS_REGION set in my environment and this could be causing it. A possible similar issue is: aws/aws-sdk-js-v3#3469

% yarn sls create_domain --aws-profile my-profile
yarn run v1.22.19
$ /Users/.../awk-eden-bridge/node_modules/.bin/sls create_domain --aws-profile my-profile
Environment: darwin, node 14.21.3, framework 3.30.1 (local), plugin 6.2.3, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: Region is missing
    at default (/Users/.../awk-eden-bridge/node_modules/@aws-sdk/config-resolver/dist-cjs/regionConfig/config.js:10:15)
    at /Users/.../awk-eden-bridge/node_modules/@aws-sdk/node-config-provider/dist-cjs/fromStatic.js:6:83
    at /Users/.../awk-eden-bridge/node_modules/@aws-sdk/property-provider/dist-cjs/chain.js:11:28
    at async coalesceProvider (/Users/.../awk-eden-bridge/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:14:24)
    at async /Users/.../awk-eden-bridge/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:26:28

Hi @CodeZeno

Could you please try the latest 7.0.3 release?

Hi there

Closing it as the issue was fixed in the release 7.0.3