amplify-education / serverless-domain-manager

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

Error: V1 - Unable to fetch information about domain #621

Open rsi-mrobinson opened 5 months ago

rsi-mrobinson commented 5 months ago

Community Note

Bug Report

Error Description With the configuration below, I am unable to deploy/create/manage domains using this plugin. However rolling back to v6.4.4 causes the issue to go away and allows deployments to proceed.

Command Run sls deploy --stage dev

Console Output

× Stack dev-proto-test-nodejs-api failed to deploy (0s)
Environment: linux, node 18.19.1, framework 3.38.0 (local) 3.37.0v (global), plugin 7.2.2, SDK 4.5.1
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: V1 - Unable to fetch information about 'api.dev.elevate.riverside-insights.com':
The security token included in the request is invalid.
    at APIGatewayV1Wrapper.<anonymous> (/__w/proto-test-nodejs-api/proto-test-nodejs-api/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v1-wrapper.js:77:27)
    at Generator.throw (<anonymous>)
    at rejected (/__w/proto-test-nodejs-api/proto-test-nodejs-api/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)

Domain Manager Configuration

customDomain:
    basePath: nodeapi
    domainName: ${self:custom.domains.${self:provider.stage}}
    stage: ${self:provider.stage}
    createRoute53Record: true
    securityPolicy: tls_1_2
    endpointType: edge
    apiType: rest

Versions

Additional context/Screenshots There is definitely nothing wrong with the credentials being used, by only changing the package and package-lock I can resolve the issue.

rddimon commented 5 months ago

Hi @rsi-mrobinson

Could you please provide some more info about how your credentials are set?

rsi-mrobinson commented 5 months ago

we're setting the credentials with serverless config credentials in a github action

  - name: Assume Remote Role
    id: aws-creds
    uses: aws-actions/configure-aws-credentials@v4
    with:
      aws-region: us-east-1
      role-to-assume: arn:aws:iam::${{ steps.account-config.outputs.pipeline-account }}:role/rolename
      disable-retry: true
      web-identity-token-file: /var/run/secrets/eks.amazonaws.com/serviceaccount/token
      output-credentials: true

  - name: Serverless Authentication
    run: |
      serverless config credentials \
        --provider aws \
        --overwrite \
        --key ${{ steps.aws-creds.outputs.aws-access-key-id }} \
        --secret ${{ steps.aws-creds.outputs.aws-secret-access-key }} \
        --profile profile-name
anttijva commented 2 months ago

I can confirm rollback to 6.4.4 works. We are currently only doing local deployments and use the 'serverless-better-credentials' plugin to authorize deployments with SSO. Some additional context that maybe helps:

Redacted our API gateway custom domain name (CUSTOM_DOMAIN).

× Stack local_repository failed to deploy (2s)                                                                                                                  
Environment: win32, node 20.14.0, framework 3.39.0 (local) 3.39.0v (global), plugin 7.2.3, SDK 4.5.1
Credentials: Local, environment variables
Docs:        [docs.serverless.com](http://docs.serverless.com/)
Support:     [forum.serverless.com](http://forum.serverless.com/)
Bugs:        [github.com/serverless/serverless/issues](http://github.com/serverless/serverless/issues)

Error:
Error: V1 - Unable to fetch information about (CUSTOM_DOMAIN):
TimeoutError: read ECONNRESET
    at APIGatewayV1Wrapper.<anonymous> (C:\code\local_repository\node_modules\serverless-domain-manager\dist\src\aws\api-gateway-v1-wrapper.js:83:27)
    at Generator.throw (<anonymous>)
    at rejected (C:\code\local_repository\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)

full error message logging:

CredentialsProviderError: TimeoutError: read ECONNRESET                                                                                                              
    at resolveSSOCredentials (C:\code\local_repository\node_modules\@aws-sdk\credential-provider-sso\dist-cjs\index.js:118:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async resolveProfileData (C:\code\local_repository\node_modules\@aws-sdk\credential-provider-ini\dist-cjs\index.js:227:12)
    at async C:\code\local_repository\node_modules\@smithy\property-provider\dist-cjs\index.js:97:27
    at async coalesceProvider (C:\code\local_repository\node_modules\@smithy\property-provider\dist-cjs\index.js:124:18)
    at async C:\code\local_repository\node_modules\@smithy\property-provider\dist-cjs\index.js:142:18
    at async C:\code\local_repository\node_modules\@smithy\core\dist-cjs\index.js:82:17
    at async C:\code\local_repository\node_modules\@aws-sdk\middleware-logger\dist-cjs\index.js:34:22 {
  tryNextLink: false
}