Skip to content

(cli-lib): cannot load the default bootstrap template #26224

@AntonioAngelino

Description

@AntonioAngelino

Describe the bug

I discovered a bug in the bootstrap command I implemented yesterday. It doesn't work out of the box because it cannot find the default YAML template.

The cli-lib tries to load the bootstrap-template.yaml in @aws-cdk/cli-lib-alpha/lib/api/bootstrap/bootstrap-template.yaml instead of aws-cdk/lib/api/bootstrap/bootstrap-template.yaml

Expected Behavior

CDK deploys the default bootstrap stack.

Current Behavior

The CLI returns the following error:

Environment aws://XXXXXXX/us-east-1 failed bootstrapping: [Error: ENOENT: no such file or directory, open 'XXXX/node_modules/@aws-cdk/cli-lib-alpha/lib/api/bootstrap/bootstrap-template.yaml'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'XXXX/node_modules/@aws-cdk/cli-lib-alpha/lib/api/bootstrap/bootstrap-template.yaml'
}

Reproduction Steps

Follow the CLI lib documentation to create an instance of the AwsCdkCli and then invoke the cli.bootstrap(); method.

Possible Solution

The following line should be edited:

return loadStructuredFile(path.join(rootDir(), 'lib', 'api', 'bootstrap', 'bootstrap-template.yaml'));

I can open a new PR, but I'm not sure what's the best way of fixing it. Should I change rootDir() with something else?

Additional Information/Context

No response

CDK CLI Version

main branch

Framework Version

No response

Node.js Version

18

OS

node:18-alpine

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions