Hello I would greatly appreciate any comments of the possible source of this error I am getting when using the AWS Cloud Development Kit (CDK) to deploy a Code Pipeline
I have a Typecript CDK project (cdk init --language typescript). This uses a GitHub hook to deploy on each update of a branch in my GitHub repository. This step works fine. However, the post build step happens fails with the errors
"Phase context status code: CLIENT_ERROR Message: no matching base directory path found for cdk.out"
From the code below you can see I use @aws-cdk/pipelines , SimpleSynthAction.standardNpmSynth and I think this isn't generating the cdk.out file (?). Any comments to help me resolve this issue would be much appreciated
import { Construct, SecretValue, Stack, StackProps } from '@aws-cdk/core';
import * as cp from '@aws-cdk/aws-codepipeline';
import * as cpa from '@aws-cdk/aws-codepipeline-actions';
import * as pipelines from '@aws-cdk/pipelines';
import { WebServiceStage } from './webservice_stage';
export class MyPipelineStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const sourceArtifact = new cp.Artifact();
const cloudAssemblyArtifact = new cp.Artifact();
const sourceAction = new cpa.GitHubSourceAction({
actionName: 'GitHub',
output: sourceArtifact,
oauthToken: SecretValue.secretsManager('github-token'),
owner: 'owner',
repo: 'repo-name',
branch:'branch-name'
});
const synthAction = pipelines.SimpleSynthAction.standardNpmSynth({
sourceArtifact,
cloudAssemblyArtifact,
buildCommand: 'npm install && npm run build && npm test',
synthCommand: 'npm run synth'
});
const pipeline = new pipelines.CdkPipeline(this, 'Pipeline', {
cloudAssemblyArtifact,
sourceAction,
synthAction
});
// Dev stage
const development = new WebServiceStage(this, 'Development');
pipeline.addApplicationStage(development);
}
}
The npm 'npm run syth' just calls 'cdk synth'
I have tried running app.synth() in my /bin/my_pipeline.ts file but that doesn't fix the error.
Once again , I have googled the hell out of this and cannot resolve it so any help much appreciated. If its any use here is the buildSpec section of my output in the build logs
BuildSpec: >-
{
"version": "0.2",
"phases": {
"pre_build": {
"commands": [
"npm ci"
]
},
"build": {
"commands": [
"cd partnerportal_cicd_pipeline && npm install && npm run build && npm test",
"npm run synth"
]
}
},
"artifacts": {
"base-directory": "cdk.out",
"files": "**/*"
}
}