Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LOC-21 ⁃ Unable to perform bootstrap command with version 1.71.0 on WSL #5

Closed
rbrianhazzard opened this issue Oct 30, 2020 · 8 comments

Comments

@rbrianhazzard
Copy link

rbrianhazzard commented Oct 30, 2020

Hello - I am seeing an issue with resolving credentials during cdklocal bootstrap: Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment after trying this out today on WSL 1. I saw #2 but opened a new issue since the OP of that one mentioned it had worked in the past for them, whereas this was a fresh install for me.

I was following the CDK Example Workshop so my project is about as bare-bones as you can get. I'd appreciate any insight.

$ npm install aws-cdk-local
...
$ cdklocal --version 
1.71.0 (build 953bc25)
$ aws --version
aws-cli/2.0.59 Python/3.7.3 Linux/4.4.0-17763-Microsoft exe/x86_64.ubuntu.18
$ docker images | grep localstack
localstack/localstack     latest              abd9bf591dfd        28 hours ago        839MB
$ SERVICES=serverless,sqs,sns,sts localstack start

... new prompt

$ mkdir cdk-local-ws
$ cd cdk-local-ws
$ cdklocal init sample-app --language=typescript
$ cdklocal synth
...
$ cdklocal bootstrap
Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

My ~/.aws/credentials (I only use AWS Local):

[default]
aws_access_key_id = dummy
aws_secret_access_key = dummy

My ~/.aws/config:

[default]
region = us-east-1
output = json

Any thoughts are appreciated! Let me know if I can provide more information.

┆Issue is synchronized with this Jira Bug by Unito

@rbrianhazzard rbrianhazzard changed the title Unable to perform commands with version 1.71.0 on WSL Unable to perform bootstrap command with version 1.71.0 on WSL Oct 30, 2020
@whummer
Copy link
Member

whummer commented Nov 1, 2020

Thanks for reporting @rbrianhazzard .

I was able to reproduce the error (Unable to resolve AWS account to use. It must be ...) - but only if the LocalStack container is not running.

As soon as the container is started up properly with the services you described (specifically also STS), then it seems to be working:

$ cdklocal bootstrap
 ⏳  Bootstrapping environment aws://000000000000/us-east-1...
CDKToolkit: creating CloudFormation changeset...
[··························································] (0/3)

 ✅  Environment aws://000000000000/us-east-1 bootstrapped.

Can you please share the log output you're seeing (with DEBUG=1 enabled), and verify that the LocalStack container is fully started

...
Starting mock STS service on http port 4566 ...
...
Ready.

@jakeswenson
Copy link

jakeswenson commented Nov 1, 2020

I'm getting the same error.

Setup:

  • cdklocal installed

    ❯ cdklocal --version
    1.71.0 (build 953bc25)
    
  • localstack/localstack:0.12.1 running

  • verified:

    ❯ aws --endpoint-url http://localhost:4566 sns list-topics
    {
        "Topics": []
    }
    

but when running cdklocal:

❯ cdklocal bootstrap

Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment
❯ cdklocal deploy
Unable to resolve AWS account to use. It must be either configured when you define your CDK or through the environment

@rbrianhazzard
Copy link
Author

Thanks for looking into this @whummer ! Can you clarify the debug command you'd like me to run? I tried both SERVICES=serverless,sqs,sns,sts localstack start DEBUG=1 and cdklocal bootstrap DEBUG=1 and neither would run.

(localstack) $ SERVICES=serverless,sqs,sns,sts localstack start
/home/brian/dev/venv/localstack/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.25.11) or chardet (3.0.4) doesn't match a supported version!
LocalStack version: 0.12.1
Starting local dev environment. CTRL-C to quit.
docker run -it -e SERVICES="serverless,sqs,sns,sts" -e TEST_AWS_ACCOUNT_ID="000000000000" -e DEFAULT_REGION="us-east-1" -e LOCALSTACK_HOSTNAME="localhost" --rm --privileged --name localstack_main -p 4566:4566 -p 8080-8081:8080-8081  -v "/tmp/localstack:/tmp/localstack" -v "/var/run/docker.sock:/var/run/docker.sock" -e DOCKER_HOST="unix:///var/run/docker.sock" -e HOST_TMP_FOLDER="/tmp/localstack" "localstack/localstack"
Waiting for all LocalStack services to be ready
2020-11-02 13:54:44,091 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
2020-11-02 13:54:44,095 INFO supervisord started with pid 13
2020-11-02 13:54:45,099 INFO spawned: 'dashboard' with pid 19
2020-11-02 13:54:45,103 INFO spawned: 'infra' with pid 20
2020-11-02 13:54:45,111 INFO success: dashboard entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
2020-11-02 13:54:45,111 INFO exited: dashboard (exit status 0; expected)
(. .venv/bin/activate; exec bin/localstack start --host)
LocalStack version: 0.12.1
Starting local dev environment. CTRL-C to quit.
2020-11-02 13:54:46,758 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Starting edge router (https port 4566)...
Starting mock API Gateway service on http port 4566 ...
Starting mock CloudFormation service on http port 4566 ...
Starting mock CloudWatch service on http port 4566 ...
Starting mock DynamoDB service on http port 4566 ...
Starting mock DynamoDB Streams service on http port 4566 ...
Starting mock IAM service on http port 4566 ...
Starting mock STS service on http port 4566 ...
Starting mock Kinesis service on http port 4566 ...
2020-11-02T13:54:50:INFO:localstack.utils.analytics.profiler: Execution of "load_plugin_from_path" took 4041.1908626556396ms
2020-11-02T13:54:50:INFO:localstack.utils.analytics.profiler: Execution of "load_plugins" took 4041.4860248565674ms
2020-11-02T13:54:50:INFO:localstack.multiserver: Starting multi API server process on port 35497
[2020-11-02 13:54:50 +0000] [21] [INFO] Running on https://0.0.0.0:4566 (CTRL + C to quit)
2020-11-02T13:54:50:INFO:hypercorn.error: Running on https://0.0.0.0:4566 (CTRL + C to quit)
[2020-11-02 13:54:50 +0000] [21] [INFO] Running on http://0.0.0.0:35497 (CTRL + C to quit)
2020-11-02T13:54:50:INFO:hypercorn.error: Running on http://0.0.0.0:35497 (CTRL + C to quit)
Waiting for all LocalStack services to be ready
Starting mock Lambda service on http port 4566 ...
Starting mock CloudWatch Logs service on http port 4566 ...
Starting mock S3 service on http port 4566 ...
Starting mock SNS service on http port 4566 ...
Starting mock SQS service on http port 4566 ...
Waiting for all LocalStack services to be ready
Ready.
2020-11-02T13:55:00:INFO:localstack.utils.analytics.profiler: Execution of "start_api_services" took 10519.129037857056ms
$ awslocal s3api list-buckets
{
    "Buckets": [],
    "Owner": {
        "DisplayName": "webfile",
        "ID": "bcaf1ffd86f41161ca5fb16fd081034f"
    }
}

@sync-by-unito sync-by-unito bot changed the title Unable to perform bootstrap command with version 1.71.0 on WSL LOC-21 ⁃ Unable to perform bootstrap command with version 1.71.0 on WSL Nov 11, 2020
@sync-by-unito sync-by-unito bot closed this as completed Nov 13, 2020
@miho120 miho120 reopened this Nov 13, 2020
@guoliang
Copy link

Can you clarify the debug command you'd like me to run? I tried both

@rbrianhazzard did you find out?
If you are on unix you start localhost in debug mode as following

DEBUG=1 localstack start

if you are on Windows you need to set DEBUG as environment variable first

set DEBUG=1
localstack start

@whummer
Copy link
Member

whummer commented Dec 13, 2020

Thanks for the update @rbrianhazzard @jakeswenson @guoliang . Looks like the bootstrapping issue should be fixed in the latest version - can you please give it a try with aws-cdk-local@1.65.2? Thanks

@rbrianhazzard
Copy link
Author

Thank @whummer - I'll take a look later today

@rbrianhazzard
Copy link
Author

The fix worked - I was able to do cdk synth on WSL with the instructions in my initial post using aws-cdk-local@1.65.2 and aws-cdk@1.78.0

Thanks for the help everyone

@Branchverse
Copy link

Branchverse commented Jul 12, 2022

same issue, using 0.14.5 localstack and 2.31.1 cdklocal

localstack running on localhost:4566 ==> confirmed
cdklocal synth works as expected
cdklocal bootstrap throws the known error "Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment"

SOLVED: addiing --profile default to the command fixed it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants