amplify-education / serverless-domain-manager

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

Region/credential failure on 7.0.1 #568

Closed amadensor closed 1 year ago

amadensor commented 1 year ago

Community Note

Bug Report

Error Description Throws error on create_domain or deploy.

Command Run sls deploy, sls create_domain, etc.

Console Output On create_domain:

Error:
Error: Region is missing
    at default (/home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/config-resolver/dist-cjs/regionConfig/config.js:10:15)
    at /home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/node-config-provider/dist-cjs/fromStatic.js:6:83
    at /home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/property-provider/dist-cjs/chain.js:11:28
    at async coalesceProvider (/home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:14:24)
    at async /home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:26:28

On deploy:


Error:
Error: V1 - Unable to fetch information about 'dev.example.com':
Could not load credentials from any providers
    at APIGatewayV1Wrapper.<anonymous> (/opt/hostedtoolcache/node/18.15.0/x64/lib/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v1-wrapper.js:68:27)
    at Generator.throw (<anonymous>)
    at rejected (/opt/hostedtoolcache/node/18.15.0/x64/lib/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v1-wrapper.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: Process completed with exit code 1.

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

yaml
  customDomain:
    basePath: ${opt:stage}-${self:app}
    domainName: ${env:API_GATEWAY_SUBDOMAIN, opt:stage}.example.com

Versions

Possible Solution

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

amadensor commented 1 year ago

Thank you for the very speedy response.

Unfortunately, still failing: npm i -g serverless npm i -g serverless-python-requirements npm i -g serverless-wsgi npm i -g serverless-domain-manager npm list -g

found 0 vulnerabilities /home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib ├── aws-cdk@2.70.0 ├── corepack@0.15.1 ├── npm@8.19.3 ├── serverless-domain-manager@7.0.2 ├── serverless-python-requirements@6.0.0 ├── serverless-wsgi@3.0.2 └── serverless@3.29.0

Environment: linux, node 16.19.1, framework 3.29.0, plugin 6.2.3, SDK 4.3.2 Credentials: Serverless Dashboard, "Shared Applications Dev" provider (https://app.serverless.com/innovationit/apps/accounting/funds-attribution/dev/us-east-2/providers) Docs: docs.serverless.com Support: forum.serverless.com Error: Error: Region is missing at default (/home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/config-resolver/dist-cjs/regionConfig/config.js:10:15) at /home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/node-config-provider/dist-cjs/fromStatic.js:6:83 at /home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/property-provider/dist-cjs/chain.js:11:28 at async coalesceProvider (/home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:14:24) at async /home/runner/actions-runner/_work/_tool/node/16.19.1/x64/lib/node_modules/serverless-domain-manager/node_modules/@aws-sdk/property-provider/dist-cjs/memoize.js:26:28 Bugs: github.com/serverless/serverless/issues

1 deprecation found: run 'serverless doctor' for more details Error: Process completed with exit code 1.

rddimon commented 1 year ago

Hi @amadensor

  1. Could you please provide your sls config with the provider section?
  2. How do you do create_domain and deploy? Do you use an AWS profile to runt it?
amadensor commented 1 year ago

provider: name: aws runtime: python3.9 region: us-east-2 tags: env: ${opt:stage, self:provider.stage} sls-app: ${self:app} sls-service: ${self:service} stackTags: alert-group: neighbor-to-neighbor apiGateway: apiKeys:

We run them very simply (not many options) sls create_domain -s dev sls deploy -s $SERVERLESS_STAGE

With auth driven by environment variables: env: SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }} CARS_API_KEY: ${{ secrets.CARS_API_KEY_DEV }}

amadensor commented 1 year ago

So, it is getting its AWS credentials via a trust relationship with Serverless.

rddimon commented 1 year ago

Thank you!

I need some time to debug it as our integration tests work But might not cover your case

amadensor commented 1 year ago

Let me know how I can help.

vighnesh153 commented 1 year ago

I am using v7.0.2 and following is my config if it helps to debug the issue:

service: my-api
frameworkVersion: '3'

plugins:
  - serverless-domain-manager

provider:
  name: aws
  stage: dev  # default stage
  region: us-east-1
  runtime: nodejs18.x
  deploymentMethod: direct
  versionFunctions: false

params:
  prod:
    domain: '...'
  dev:
    domain: '...'

custom:
  customDomain:
    domainName: ${param:domain}
    basePath: ''
    certificateName: '...'
    stage: ${self:provider.stage}
    createRoute53Record: true
2904nando commented 1 year ago

Getting the same error on my personal project when trying to deploy using Github Actions and Serverless.

My Github Actions are set to run Serverless deploy and the Authorization with AWS is fully handled by a Provider created in the Serverless Dashboard.

cfergie commented 1 year ago

I reverted to v6.4.4 which worked for me.

henrythethird commented 1 year ago

We are also still getting the same error with v7.0.2. A revert to v6.4.4 works as a workaround :heavy_check_mark:

chris commented 1 year ago

572 may be related/the same problem - I don't see credentials used/set in any of the 7.x code (unlike 6.4.4 where there is a credentials param for the constructors of the APIGateway and similar objects.

rddimon commented 1 year ago

Hi @amadensor

Could you please try the latest version and let us know the result?

vighnesh153 commented 1 year ago

Works like a charm for me. 🦄 🚀

Just for reference, could you link the commit/pull request which fixed this issue so that if this issue regresses again, we will have something to look at.

rddimon commented 1 year ago

All changes in the latest 7.0.3 release