Skip to content

Deployment of custom domain fails when using credentials from aws-profile #13109

@zdvhm

Description

@zdvhm

Issue description

Version 4.18.0 adds support for deploying custom domain names. When using this new functionality, it seems that deployment cannot use credentials from the given AWS profile:
> sls deploy --stage test --aws-profile my-aws-profile

(...)
s:cli-error-handler: Error: V1 - Unable to fetch information about '<my-domain>.com':
Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
    at APIGatewayV1Wrapper.getCustomDomain (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/plugins/aws/domains/aws/api-gateway-v1-wrapper.js:95:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async ServerlessCustomDomain.createDomain (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/plugins/aws/domains/index.js:314:25)
    at async <anonymous> (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/plugins/aws/domains/index.js:456:11)
    at async Promise.all (index 0)
    at async ServerlessCustomDomain.createOrGetDomainForCfOutputs (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/plugins/aws/domains/index.js:452:5)
    at async PluginManager.runHooks (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/classes/plugin-manager.js:724:9)
    at async PluginManager.invoke (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/classes/plugin-manager.js:762:9)
    at async PluginManager.run (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/classes/plugin-manager.js:812:7)
    at async Serverless.run (<HOME_DIR>/.serverless/releases/4.18.0/serverless/lib/serverless.js:219:5)

The same error occurs when AWS_SDK_LOAD_CONFIG=1 is set to env and/or when profile is given in the env var AWS_PROFILE, or in provider['profile'] of serverless.ts

With serverless-domain-manager plugin this works for the same app:
sls create_domain --stage test --aws-profile my-aws-profile
sls deploy --stage test --aws-profile my-aws-profile

Context

Service Overview

  • Serverless Framework Version: 4.18.0
  • Service Config File: serverless.ts
  • Service Runtime: nodejs22.x
  • Service Stage: test
  • Service Region: eu-north-1
  • Error Code: API_GATEWAY_CUSTOM_DOMAIN_FETCH_FAILED

Service Path

/Users/foo/my-app/serverless.ts

Command

deploy --stage test,--verbose true,--debug *,--aws-profile my-aws-profile

Error Message

V1 - Unable to fetch information about '<my-domain>.com':
Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions