I'm attemping to create a CodePipeline that has 1 stage with 1 stack: NextStack
. On cdk deploy
I'm getting CREATE_FAILED | AWS::CodePipeline::Pipeline | TodolistPipeline/Pipeline Internal Failure
without any other logs. What could be causing this error?
bin.ts:
import * as cdk from '@aws-cdk/core';
import { PipelineStack } from './pipeline-stack';
const app = new cdk.App();
new PipelineStack(app, 'TodolistPipeline', {
env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: 'us-east-1' },
});
pipeline-stack.ts:
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import {
CodePipeline,
CodePipelineSource,
ShellStep,
} from '@aws-cdk/pipelines';
import { NextJsStage } from './front-end-stage';
export class PipelineStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const pipeline = new CodePipeline(this, 'MainDeploymentPipeline', {
pipelineName: 'TodolistDeploymentPipeline',
synth: new ShellStep('Synth', {
input: CodePipelineSource.gitHub('AndyW22/todolist', 'main'),
commands: [
'n 16',
'yarn install --frozen-lockfile',
'cd cdk_stack && yarn install --frozen-lockfile && cd ../',
'ts-node cdk_stack/compileNext.ts ',
'npx cdk synth',
],
}),
});
pipeline.addStage(new NextJsStage(this, 'Front-end'));
}
}
front-end-stage:
import { Construct, StackProps, Stage } from '@aws-cdk/core';
import { NextStack } from './next-stack';
export class NextJsStage extends Stage {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
new NextStack(this, 'FrontEndStack', {
env: {
region: 'us-east-1',
},
analyticsReporting: true,
description: 'Front end NextJS stack for todolist',
});
}
}
next-stack:
import { Runtime } from '@aws-cdk/aws-lambda';
import * as cdk from '@aws-cdk/core';
import { Duration } from '@aws-cdk/core';
import { NextJSLambdaEdge } from '@sls-next/cdk-construct';
export class NextStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props: cdk.StackProps) {
super(scope, id, props);
new NextJSLambdaEdge(this, 'NextJsApp', {
serverlessBuildOutDir: './build',
runtime: Runtime.NODEJS_12_X,
memory: 1024,
timeout: Duration.seconds(30),
withLogging: true,
name: {
apiLambda: `${id}Api`,
defaultLambda: `Fn${id}`,
imageLambda: `${id}Image`,
},
});
}
}
The issue ended up being that the secret in AWS Secrets Manager was in the wrong region, adding it to the correct region fixed the problem.