amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Region/credential failure on 7.0.1

amadensor opened this issue Β· 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
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

  • Domain Manager version(s): 7.0.1
  • Node/npm version: 18.15.0
  • Serverless Version: 3.28.1
  • Lambda Code Python

Possible Solution

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

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.

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?

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:
- ${self:service}-${opt:stage}-key
deploymentBucket: compassion-tomorrow-shared-apps-${env:BUCKET_STAGE, opt:stage, self:provider.stage}-serverless-deployment
iamRoleStatements:
- Effect: "Allow"
Action:
- "sns:Publish"
Resource: !Ref FundsTopic
- Effect: "Allow"
Action: "rds-db:connect"
Resource: "arn:aws:rds-db:::dbuser:/funds_q"
- Effect: "Allow"
Action: "rds-db:connect"
Resource: "arn:aws:rds-db:
::dbuser:/funds_api"

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 }}

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

Thank you!

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

Let me know how I can help.

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

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.

I reverted to v6.4.4 which worked for me.

We are also still getting the same error with v7.0.2. A revert to v6.4.4 works as a workaround βœ”οΈ

#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.

Hi @amadensor

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

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.

All changes in the latest 7.0.3 release