Skip to content

bug: Unable to run cdk bootstrap with aws-cdk 2.172.0 (or newer) and cdklocal 2.19.2 #108

@simonrw

Description

@simonrw

Original issue: localstack/localstack#12261 reported by @Garethp


Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When attempting to run yarn cdklocal bootstrap on LocalStack with aws-cdk set to 2.172.0 or newer, I get the following error:

 ❌  Environment aws://000000000000/eu-west-2 failed bootstrapping: Error: Need to perform AWS calls for account 000000000000, but no credentials have been configured
    at SdkProvider.forEnvironment (/home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:776:19853)
    at async SdkProvider.methFunc (/home/parkerg/development/localstack-bugs/node_modules/aws-cdk-local/bin/cdklocal:414:16)
    at async _BootstrapStack.lookup (/home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:626:8583)
    at async Bootstrapper.modernBootstrap (/home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:627:1084)
    at async /home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:833:1671

If I try running the bootstrap with 2.178.2, the error looks like:

 ❌  Environment aws://000000000000/eu-west-2 failed bootstrapping: _AuthenticationError: Need to perform AWS calls for account 000000000000, but no credentials have been configured
    at SdkProvider.forEnvironment (/home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:809:140752)
    at async _BootstrapStack.lookup (/home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:780:25842)
    at async Bootstrapper.modernBootstrap (/home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:781:1115)
    at async /home/parkerg/development/localstack-bugs/node_modules/aws-cdk/lib/index.js:823:1560 {
  type: 'authentication'
}
Need to perform AWS calls for account 000000000000, but no credentials have been configured

Expected Behavior

This should work and there should be no Authentication issues

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run localstack/localstack

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

`yarn cdklocal bootstrap`

Environment

- OS: Ubuntu 20.04
- LocalStack: 4.1.1
  LocalStack version: 4.1.1
  LocalStack Docker image sha: sha256:97ccc65daec3542bd2cb3160d7355f11e89ad8027fd3c834b9d1197d197d866f
  LocalStack build date: 2025-02-05
  LocalStack build git hash: 873d150c0

Anything else?

I've reproduced the issue here: https://github.com/Garethp/localstack-bugs/tree/bootstrap-error
When I clone down the branch bootstrap-error, run yarn install, and then ./start.sh I see the above error.

Additionally, we do have a temporary workaround. If we run AWS_PROFILE={profile} yarn cdklocal bootstrap where {profile} is a profile that's already been locally configured and is not an sso login then it passes. If it's set to a non-existent profile or a profile that's configured through aws sso then it still fails

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions