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

running cdk bootstrap with an existing cdk.json fails attempting to execute app #31255

Open
1 task
josefaidt opened this issue Aug 29, 2024 · 8 comments
Open
1 task
Assignees
Labels
bug This issue is a bug. p2 package/tools Related to AWS CDK Tools or CLI

Comments

@josefaidt
Copy link

Describe the bug

I have a cdk.json file in my directory with the following contents

{
  "app": "tsx cdk.ts",
  "debug": true
}

When I try to run bootstrap in this directory with pnpm dlx I receive an error saying tsx is not found.

➜  pnpm dlx aws-cdk bootstrap aws://<account-id>/us-east-1
o
/bin/sh: tsx: command not found

Subprocess exited with error 127

Unlike npx, pnpm dlx (and similar with yarn) will reach out to the registry to execute instead of the local node_modules. Granted I do have the CLI in this project locally, but I thought it was odd to receive this error when running bootstrap

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

running cdk bootstrap does not execute the app

Current Behavior

see description

Reproduction Steps

  1. pnpm init
  2. add cdk.json from description
  3. run pnpm dlx aws-cdk bootstrap ...
  4. observe error

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.154.1 (build febce9d)

Framework Version

No response

Node.js Version

22.x

OS

macos

Language

TypeScript

Language Version

No response

Other information

No response

@josefaidt josefaidt added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 29, 2024
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Aug 29, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 30, 2024
@khushail khushail self-assigned this Aug 30, 2024
@khushail
Copy link
Contributor

khushail commented Aug 30, 2024

Hi @josefaidt , thanks for reaching out.

AFAIK, running cdk bootstrap command will check the cdk.json file to see the related configurations. Whether or not you mention the command 'tsx', it will check the file 'cdk.json' contents.

I found a somewhat similar issue -#8075 and an explanation and workaround for the problem.

Let me know if this is helpful on the same line, as you are pointing in this issue. Thanks!

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Aug 30, 2024
@josefaidt
Copy link
Author

Hey @khushail thanks for the clarification and the related issues! It seems like this is expected behavior that the CLI will process cdk.json -- rightfully so as it can contain details like the bootstrap stack name, though I found the behavior to (attempt to) execute the app to be unexpected.

@khushail
Copy link
Contributor

@josefaidt , that sounds perfect. So should I consider your issue to be answered and close this one ??

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Aug 31, 2024
@khushail khushail added guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Oct 9, 2024
Copy link

github-actions bot commented Oct 9, 2024

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 the closing-soon This issue will automatically close in 4 days unless further comments are made. label Oct 9, 2024
@josefaidt
Copy link
Author

Hey @khushail thank you for clarifying that the json file is being checked for the relevant configurations, however I found it unexpected that the app command was also being executed as it doesn't seem relevant to the bootstrapping process.

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Oct 10, 2024
@khushail khushail removed the guidance Question that needs advice or information. label Dec 5, 2024
@khushail
Copy link
Contributor

khushail commented Dec 5, 2024

Hi @josefaidt , apologies for the late repsonse. It might be helpful to go through the CDK bootstrapping doc which clearly mentions about running the app as well -
https://docs.aws.amazon.com/cdk/v2/guide/cli.html#cli-bootstrap

If issued with no arguments, as shown here, the cdk bootstrap command synthesizes the current app and bootstraps the environments its stacks will be deployed to. If the app contains environment-agnostic stacks, which don't explicitly specify an environment, the default account and Region are bootstrapped, or the environment specified using --profile.

so you can opt out of running the app by mentioning the --profile or environment options.

Hope that would be helpful!

@khushail khushail added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Dec 5, 2024
@josefaidt
Copy link
Author

Hey @khushail no worries! Can the current app influence how bootstrapping works? Or is it used to resolve the current account and region?

@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 7, 2024
@khushail
Copy link
Contributor

@josefaidt , AFAIU, bootstrapping is separate process. if the app contains environment agnostic stack, which means no env or region are specified, the default region and environment are bootstrapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

2 participants