From d86170d5e7fe204777c298305a6f75d73c777c12 Mon Sep 17 00:00:00 2001 From: notgitika Date: Wed, 13 May 2026 10:51:04 -0400 Subject: [PATCH] fix(deploy): restore stack selection strategy for deploy and diff Adds StackSelectionStrategy.PATTERN_MUST_MATCH with targetStackName to toolkitWrapper.deploy() and toolkitWrapper.diff() calls. Without this, the CDK toolkit fails with "NoStack: CloudFormationStack object does not hold a stack" when deploying projects with HTTP gateways. Also fixes multi-target consistency: uses targetStackName (derived from project name + target name) as the canonical stackName throughout the function, and scopes checkStackDeployability to the target stack only. Adds a guard that fails early if the target stack isn't found in the synthesized assembly. --- src/cli/commands/deploy/actions.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/cli/commands/deploy/actions.ts b/src/cli/commands/deploy/actions.ts index 803cc2852..f7210a9b2 100644 --- a/src/cli/commands/deploy/actions.ts +++ b/src/cli/commands/deploy/actions.ts @@ -43,7 +43,9 @@ import { } from '../../operations/deploy/post-deploy-config-bundles'; import { setupHttpGateways } from '../../operations/deploy/post-deploy-http-gateways'; import { enableOnlineEvalConfigs } from '../../operations/deploy/post-deploy-online-evals'; +import { toStackName } from '../import/import-utils'; import type { DeployResult } from './types'; +import { StackSelectionStrategy } from '@aws-cdk/toolkit-lib'; export interface ValidatedDeployOptions { target: string; @@ -248,7 +250,13 @@ export async function handleDeploy(options: ValidatedDeployOptions): Promise