Working with CDK Pipelines introduces a layer of complexity beyond a standard CDK stack: the pipeline provisions itself, mutates on every push, and spans multiple AWS services (CodePipeline, CodeBuild, S3, KMS, and optionally cross-account roles). Most issues fall into a small set of repeatable patterns. The sections below cover the errors developers encounter most frequently, their root causes, and the exact steps to resolve them.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/okruti-raghuraj/aws-1/llms.txt
Use this file to discover all available pages before exploring further.
Common issues
`cdk deploy` fails with "This stack uses assets"
`cdk deploy` fails with "This stack uses assets"
Cause: CDK Pipelines uses S3 buckets and (optionally) ECR repositories to stage assets during synthesis. These resources are created by the CDK bootstrap process, which must be run once per AWS account/region combination before any pipeline deployment can succeed.Fix: Run the bootstrap command, substituting your real account ID and target region:For example:After bootstrap completes you will see a
CDKToolkit CloudFormation stack in your account. Re-run cdk deploy once that stack reaches CREATE_COMPLETE.GitHub connection error: "Could not connect to GitHub"
GitHub connection error: "Could not connect to GitHub"
Cause:
CodePipelineSource.gitHub(...) relies on an AWS CodeStar Connection to authenticate with GitHub. Connections are created in a PENDING state and must be manually authorized in the AWS Console before any pipeline run can clone your repository.Fix:Open the AWS Console
Navigate to AWS Console → Developer Tools → Settings → Connections (or search for “CodeStar Connections”).
Find the pending connection
Locate the connection that was automatically created when you first deployed the stack. Its status will show Pending.
Authorize the connection
Click Update pending connection, then follow the OAuth prompts to grant AWS access to your GitHub account or organization.
Pipeline fails at the Synth stage
Pipeline fails at the Synth stage
Cause: The Synth stage runs TypeScript errors will surface during
npm ci, npm run build, and npx cdk synth inside a CodeBuild environment. If any of those commands fail — most commonly because of a TypeScript compilation error introduced in a recent commit — the entire pipeline stops at this stage.Fix: Reproduce the failure locally before pushing:npm run build (tsc). Fix all reported errors, confirm cdk synth produces output without warnings, then push the corrected commit. The pipeline will re-trigger automatically and the Synth stage will pass.`Error: AwsCdkPipelineStack: No environment specified`
`Error: AwsCdkPipelineStack: No environment specified`
Cause: CDK Pipelines requires an explicit environment (account + region) on the pipeline stack. In the generated Without it, CDK cannot resolve which account and region to target.Fix: Open If you prefer hard-coded values (useful in CI environments without the CDK CLI configured):Ensure
bin/aws-cdk-pipeline.ts entry point the env block is commented out by default:bin/aws-cdk-pipeline.ts and uncomment the env property, replacing the placeholder values with your real account ID and region:CDK_DEFAULT_ACCOUNT and CDK_DEFAULT_REGION are exported in your shell session when using the environment-variable form.`crossAccountKeys` error with KMS
`crossAccountKeys` error with KMS
Cause: The pipeline stack sets This setting disables KMS customer-managed key creation for the artifact bucket, which reduces cost and permissions overhead. However, if you later try to deploy an application stage to a different AWS account, CodePipeline cannot decrypt the artifacts in the source account’s S3 bucket and the cross-account deployment fails.Fix: Set Then ensure the target account’s deployment role has been granted permission to use the KMS key (CDK handles this automatically when both stacks are deployed with CDK Pipelines). Re-deploy the pipeline stack after making this change.
crossAccountKeys: false in the CodePipeline constructor:crossAccountKeys: true before adding any cross-account stage:`Cannot find module 'source-map-support'`
`Cannot find module 'source-map-support'`
Cause: The Verify the package is installed:If you are running inside CodeBuild and see this error in the Synth stage, confirm that the
source-map-support package (listed under dependencies in package.json) is not present in node_modules. This happens when npm install has not been run, or when node_modules was deleted or excluded from the working directory.Fix: Run npm install from inside the aws-cdk-pipeline/ directory:commands list includes npm ci as the first step — it is already present in the default configuration:Pipeline self-mutates but app changes don't deploy
Pipeline self-mutates but app changes don't deploy
Cause: The Create
AwsCdkPipelineStack in lib/aws-cdk-pipeline-stack.ts only defines the pipeline infrastructure. Application stages (the actual workloads) must be added to the pipeline explicitly with pipeline.addStage(). The scaffolded code leaves MyPipelineAppStage commented out, so only the pipeline itself is ever updated — your application changes are never deployed.Fix: Define your application stage and add it to the pipeline. Using the pattern from the CDK Pipelines documentation:lib/my-pipeline-app-stage.ts as a cdk.Stage subclass that instantiates your application stacks. Push the change — the pipeline will self-mutate to include the new stage on its next run, then immediately execute it.Useful debugging commands
The following commands help you inspect and manage the pipeline stack without navigating the AWS Console:cdk synth is especially useful during troubleshooting: if synthesis fails locally you will see the exact TypeScript or CDK error before it reaches CodeBuild. cdk diff shows property-level changes between your local code and what is currently deployed, which helps confirm that a fix will actually change the intended resource.