localstack / localstack/aws-cdk-local
bug: Unable to run cdk bootstrap with aws-cdk 2.172.0 (or newer) and cdklocal 2.19.2
@simonrw is already working on this.
Since Mar 12, 2025.
- Dominant language
- JavaScript
- Stars
- 305
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
Original issue: https://github.com/localstack/localstack/issues/12261 reported by @Garethp
---
### Is there an existing issue for this?
- [x] 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
```markdown
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.