Environment information
- @aws-amplify/backend-cli: 1.7.2 (also reproduced with 1.8.0 and 1.8.2)
- @aws-cdk/toolkit-lib: 1.15.0 (via 1.7.2) and 1.16.0 (via 1.8.x)
- Node.js: 20.x (Amplify CodeBuild default)
- Region: us-east-1
- Amplify App ID: xxxxxxxxxxx
- Build image: Standard (8GiB Memory, 4vCPUs)
Binaries:
Node: 23.11.0
Yarn: undefined - undefined
npm: 11.3.0
pnpm: undefined - undefined
NPM Packages:
@aws-amplify/auth-construct: 1.11.2
@aws-amplify/backend: 1.21.1
@aws-amplify/backend-ai: Not Found
@aws-amplify/backend-auth: 1.9.2
@aws-amplify/backend-cli: 1.8.2
@aws-amplify/backend-data: 1.6.4
@aws-amplify/backend-deployer: 2.1.6
@aws-amplify/backend-function: 1.17.0
@aws-amplify/backend-output-schemas: 1.8.0
@aws-amplify/backend-output-storage: 1.3.4
@aws-amplify/backend-secret: 1.4.2
@aws-amplify/backend-storage: 1.4.3
@aws-amplify/cli-core: 2.2.4
@aws-amplify/client-config: 1.10.1
@aws-amplify/data-construct: 1.17.0
@aws-amplify/data-schema: 1.25.3
@aws-amplify/deployed-backend-client: 1.8.1
@aws-amplify/form-generator: 1.2.6
@aws-amplify/model-generator: 1.2.2
@aws-amplify/platform-core: 1.11.0
@aws-amplify/plugin-types: 1.12.0
@aws-amplify/sandbox: 2.2.0
@aws-amplify/schema-generator: 1.4.1
@aws-cdk/toolkit-lib: 1.16.0
aws-amplify: 6.16.3
aws-cdk-lib: 2.244.0
Describe the bug
npx ampx pipeline-deploy fails during the deploy phase with AuthenticationError: Unable to resolve AWS account to use. The debug output shows the root cause:
Looking up default account ID from STS
AWS SDK Call STSClient: GetCallerIdentityCommand
Unable to determine the default AWS account (Error): [EntityReplacer] Invalid character '#' in entity name: "#xD"
Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.
The GetCallerIdentity STS call returns an XML response containing 
 (carriage return entity) that fast-xml-parser's EntitiesParser cannot handle, throwing Invalid character '#' in entity name: "#xD".
Key observations:
- The synth phase succeeds (CDK_DEFAULT_REGION is set, backend synthesizes in ~19s, type checks pass)
- The deploy phase fails because SdkProvider.resolveEnvironment calls STS again independently and the XML parsing fails
- Setting CDK_DEFAULT_ACCOUNT env var does NOT help — the deploy phase ignores it and calls STS internally
- The same code deploys successfully via npx ampx sandbox locally
- The same code deployed successfully on April 15, 2026 — the issue started on April 17 without any code changes
- Clean installs with rm -rf node_modules package-lock.json and pinning @aws-amplify/backend-cli to 1.7.2 (pre-1.8.x) still reproduce the issue
- The bug appears to be in the Amplify/CodeBuild build environment's STS response, not in any specific toolkit-lib version
Reproduction steps
- Create an Amplify Gen 2 app with pipeline-deploy in amplify.yml
- Deploy via CodeCommit trigger to Amplify Hosting (us-east-1)
- Build spec:
version: 1
backend:
phases:
preBuild:
commands:
- npm install
build:
commands:
- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
- Build fails with [AuthenticationError] Unable to resolve AWS account to use
- Adding --debug flag reveals the
XML parsing error in the STS response
Expected behavior: pipeline-deploy should successfully resolve the AWS account and deploy the CloudFormation stack.
Additional context:
- The aws sts get-caller-identity CLI command works fine in the same build environment (used to set CDK_DEFAULT_ACCOUNT)
- The issue is specifically in the AWS SDK JS XML deserializer used by @aws-cdk/toolkit-lib when parsing the STS XML response
- This affects all recent versions of @aws-amplify/backend-cli (tested 1.7.2, 1.8.0, 1.8.2)
- Last successful deploy was April 15, 2026 using cached node_modules from a previous build
Environment information
Describe the bug
npx ampx pipeline-deploy fails during the deploy phase with AuthenticationError: Unable to resolve AWS account to use. The debug output shows the root cause:
Key observations:
Reproduction steps
Expected behavior: pipeline-deploy should successfully resolve the AWS account and deploy the CloudFormation stack.
Additional context: