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

(pipeline): no matching base directory path found for cdk/cdk.out #28519

Open
best-cloud opened this issue Dec 29, 2023 · 5 comments
Open

(pipeline): no matching base directory path found for cdk/cdk.out #28519

best-cloud opened this issue Dec 29, 2023 · 5 comments
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/core Related to core CDK functionality @aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/medium Medium work item – several days of effort needs-review p1 package/tools Related to AWS CDK Tools or CLI

Comments

@best-cloud
Copy link

best-cloud commented Dec 29, 2023

Describe the bug

I am using CDK with CodePipeline and CodeBuild, everything works fine in Linux aws/codebuild/standard:6.0.

However, when I upgrade to aws/codebuild/standard:7.0 or Amazon Linux 2 x86_64 standard image, version 5.0, npx cdk synth does nothing, as the result I got the following errors when synthesizing from pipeline.

42 | [Container] 2023/12/29 07:11:14.079166 Running command npx cdk synth
43 |  
44 | [Container] 2023/12/29 07:11:16.641555 Phase complete: BUILD State: SUCCEEDED
45 | [Container] 2023/12/29 07:11:16.641572 Phase context status code:  Message:
46 | [Container] 2023/12/29 07:11:16.683183 Entering phase POST_BUILD
47 | [Container] 2023/12/29 07:11:16.684920 Phase complete: POST_BUILD State: SUCCEEDED
48 | [Container] 2023/12/29 07:11:16.684933 Phase context status code:  Message:
49 | [Container] 2023/12/29 07:11:16.770308 Expanding base directory path: cdk/cdk.out
50 | [Container] 2023/12/29 07:11:16.773789 Assembling file list
51 | [Container] 2023/12/29 07:11:16.773807 Expanding cdk/cdk.out
52 | [Container] 2023/12/29 07:11:16.776932 Skipping invalid file path cdk/cdk.out
53 | [Container] 2023/12/29 07:11:16.777023 Phase complete: UPLOAD_ARTIFACTS State: FAILED
54 | [Container] 2023/12/29 07:11:16.777033 Phase context status code: CLIENT_ERROR Message: no matching base directory path found for cdk/cdk.out

Expected Behavior

cdk/cdk.out should be found

Current Behavior

cdk/cdk.out is not found

Reproduction Steps

export class CdkStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

      const pipeline = new CodePipeline(this, 'Pipeline', {
      pipelineName: 'Pipeline',
      crossAccountKeys: true,
      synth: new ShellStep('Synth', {
        input: xxx,
        commands: ['cd cdk', 'npm ci', 'npm run build', 'npx cdk synth'],
        primaryOutputDirectory: 'cdk/cdk.out'
      }),
      codeBuildDefaults: {
        buildEnvironment: {
          buildImage: LinuxBuildImage.STANDARD_7_0
        }
      }
    })
  }
}

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.117.0 (build 59d9b23)

Framework Version

No response

Node.js Version

20.10.4

OS

Linux

Language

TypeScript

Language Version

No response

Other information

No response

@best-cloud best-cloud added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 29, 2023
@github-actions github-actions bot added package/tools Related to AWS CDK Tools or CLI @aws-cdk/aws-codepipeline Related to AWS CodePipeline labels Dec 29, 2023
@best-cloud best-cloud changed the title (aws-cdk): no matching base directory path found for cdk/cdk.out (pipeline): no matching base directory path found for cdk/cdk.out Dec 29, 2023
@github-actions github-actions bot added the @aws-cdk/pipelines CDK Pipelines library label Dec 29, 2023
@pahud
Copy link
Contributor

pahud commented Jan 2, 2024

Yes I can reproduce this issue. It fails in STANDARD_7_0 but works in STANDARD_6_0 with exactly the same configuration.

@pahud pahud added p1 effort/medium Medium work item – several days of effort needs-review and removed needs-triage This issue or PR still needs to be triaged. labels Jan 2, 2024
@best-cloud
Copy link
Author

Hi team, is there any ETA for this issue?

@vroegop
Copy link

vroegop commented Jan 23, 2024

When I run it using a global installed version (npm i -g aws-cdk) I do get a cdk.out directory locally with the cdk synth command while with the npx cdk synth I got nothing.
The package.json version and global version match so I'm not sure why.

Changing npx cdk synth to cdk synth fixed the issue on CodePipeline too, in my case.

@indieisaconcept
Copy link

I recently had a version of this error myself. The fix was simple, I updated my cdk.json output path from ../../dist/packages/infra to ../../dist/packages/infra/cdk.out.

Prior to this change cdk.out referred to a JSON file in ../../dist/packages/infra.

@best-cloud
Copy link
Author

The issue has been there for more than 2 months, is there any plan to fix it?

@pahud pahud added the @aws-cdk/core Related to core CDK functionality label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-codepipeline Related to AWS CodePipeline @aws-cdk/core Related to core CDK functionality @aws-cdk/pipelines CDK Pipelines library bug This issue is a bug. effort/medium Medium work item – several days of effort needs-review p1 package/tools Related to AWS CDK Tools or CLI
Projects
None yet
Development

No branches or pull requests

4 participants