为什么这个 CDK 应用程序通过 cdk 部署提供 "Internal Failure"?

Why is this CDK app giving "Internal Failure" with cdk deploy?

我正在尝试创建一个具有 1 个阶段和 1 个堆栈的 CodePipeline:NextStack。在 cdk deploy 我得到 CREATE_FAILED | AWS::CodePipeline::Pipeline | TodolistPipeline/Pipeline Internal Failure 没有任何其他日志。什么可能导致此错误?

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' },
});

管道-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'));
  }
}

前端阶段:

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',
    });
  }
}

下一个堆栈:

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`,
      },
    });
  }
}

问题最终是 AWS Secrets Manager 中的密钥位于错误的区域,将其添加到正确的区域解决了问题。