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

(integration tests): how to set environment? #17853

Closed
markussiebert opened this issue Dec 5, 2021 · 4 comments
Closed

(integration tests): how to set environment? #17853

markussiebert opened this issue Dec 5, 2021 · 4 comments
Assignees
Labels
closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. documentation This is a problem with documentation. guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@markussiebert
Copy link
Contributor

link to reference doc page

https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md#integration-tests

Describe your issue?

If I run integration tests, i get the following error:

integ-provider-framework: deploying...

 ❌  integ-provider-framework failed: Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment
    at SdkProvider.resolveEnvironment (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts:208:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at CloudFormationDeployments.prepareSdkFor (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/api/cloudformation-deployments.ts:260:33)
    at CloudFormationDeployments.deployStack (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/api/cloudformation-deployments.ts:190:70)
    at CdkToolkit.deploy (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.ts:194:24)
    at initCommandLine (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/bin/cdk.ts:267:9)
Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment
Cleaning up.
integ-provider-framework: destroying...

 ❌  integ-provider-framework: destroy failed Error: Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment
    at SdkProvider.resolveEnvironment (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/api/aws-auth/sdk-provider.ts:208:13)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at CloudFormationDeployments.prepareSdkFor (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/api/cloudformation-deployments.ts:260:33)
    at CloudFormationDeployments.destroyStack (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/api/cloudformation-deployments.ts:229:58)
    at CdkToolkit.destroy (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.ts:348:9)
    at initCommandLine (/Users/markussiebert/github/aws-cdk/packages/aws-cdk/bin/cdk.ts:267:9)
Unable to resolve AWS account to use. It must be either configured when you define your CDK Stack, or through the environment
Error: Command exited with status 1
    at exec (/Users/markussiebert/github/aws-cdk/tools/@aws-cdk/cdk-integ-tools/lib/integ-helpers.js:349:15)
    at IntegrationTest.invokeCli (/Users/markussiebert/github/aws-cdk/tools/@aws-cdk/cdk-integ-tools/lib/integ-helpers.js:180:20)
    at main (/Users/markussiebert/github/aws-cdk/tools/@aws-cdk/cdk-integ-tools/bin/cdk-integ.js:51:32)
error Command failed with exit code 1.

I know how to set the account / region and so on for my app deployments, but don't know how to do this for integration tests if I want to run them on my machine in my aws account with access key id / and secret access key...

@markussiebert markussiebert added documentation This is a problem with documentation. feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Dec 5, 2021
@github-actions github-actions bot added the @aws-cdk/aws-secretsmanager Related to AWS Secrets Manager label Dec 5, 2021
@njlynch njlynch added guidance Question that needs advice or information. and removed feature-request A feature should be added or improved. @aws-cdk/aws-secretsmanager Related to AWS Secrets Manager needs-triage This issue or PR still needs to be triaged. labels Dec 7, 2021
@njlynch njlynch assigned peterwoodworth and unassigned njlynch Dec 7, 2021
@njlynch
Copy link
Contributor

njlynch commented Dec 7, 2021

How is your environment configured? Do you have a ~/.aws/config and ~/.aws/credentials, are you using environment variables, etc?

As the linked documentation states, we typically just run yarn integ or yarn integ $testname to run the integ tests. This resolves the current AWS credentials the same way as the cdk CLI does (in fact, via the same code paths).

@njlynch njlynch added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 7, 2021
@markussiebert
Copy link
Contributor Author

Hi, I am using ~/.aws/config and ~/.aws/credentials, nothing else. The credentials work with cdk, but the problem isn't missing credentials, it's that cdk does not know the account and region I want to use...

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 8, 2021
@peterwoodworth
Copy link
Contributor

Hey @markussiebert,

Check out #1656, that thread contains some helpful information for various CLI authentication issues.

In particular, this comment mentions integration tests #1656 (comment), and the next comment is a followup with the solution. Maybe you've run into the same issue?

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 8, 2021
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. documentation This is a problem with documentation. guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants