@go-to-k/cdkd 0.159.1 → 0.159.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -41666,7 +41666,10 @@ var CfnLocalStateProvider = class {
41666
41666
  }
41667
41667
  getClient() {
41668
41668
  if (this.disposed) throw new Error("CfnLocalStateProvider used after dispose()");
41669
- if (!this.client) this.client = new CloudFormationClient({ region: this.region });
41669
+ if (!this.client) this.client = new CloudFormationClient({
41670
+ region: this.region,
41671
+ ...this.clientOptions.profile !== void 0 && { profile: this.clientOptions.profile }
41672
+ });
41670
41673
  return this.client;
41671
41674
  }
41672
41675
  /**
@@ -54603,7 +54606,7 @@ function resolveLambdaByLogicalId(logicalId, stacks) {
54603
54606
  const memoryMb = typeof props["MemorySize"] === "number" ? props["MemorySize"] : 128;
54604
54607
  const timeoutSec = typeof props["Timeout"] === "number" ? props["Timeout"] : 3;
54605
54608
  const code = props["Code"] ?? {};
54606
- const imageUri = extractImageUri(code["ImageUri"]);
54609
+ const imageUri = extractImageUri(code["ImageUri"], logicalId, stack.stackName, stack.template.Resources ?? {});
54607
54610
  if (imageUri !== void 0) return resolveImageLambda({
54608
54611
  stack,
54609
54612
  logicalId,
@@ -54642,25 +54645,47 @@ function resolveLambdaByLogicalId(logicalId, stacks) {
54642
54645
  /**
54643
54646
  * Extract `Code.ImageUri` across the shapes CDK actually synthesizes.
54644
54647
  * Mirrors the simpler subset of `lambda-resolver.ts:extractImageUri`
54645
- * scoped to the shapes `cdkd local start-api` consumes — flat string
54646
- * and `Fn::Sub` (the canonical asset shape for
54647
- * `lambda.DockerImageCode.fromImageAsset`). `Fn::Join` shapes for
54648
- * `lambda.DockerImageCode.fromEcr` are deferred to a follow-up: the
54649
- * start-api boot flow doesn't yet load cdkd state up front, and the
54650
- * `Fn::Join` resolver needs it to recover same-stack ECR repository
54651
- * URIs. When the user hits the unsupported shape, the downstream
54652
- * resolveLocalBuildPlan / pullEcrImage path surfaces a clear error.
54648
+ * scoped to the shapes `cdkd local start-api` consumes — flat string,
54649
+ * `Fn::Sub` (the canonical asset shape for
54650
+ * `lambda.DockerImageCode.fromImageAsset`), and `Fn::Join` (the
54651
+ * canonical shape for `lambda.DockerImageCode.fromImageAsset` in
54652
+ * CDK 2.x, which emits a `Fn::Join` over the literal bootstrap ECR
54653
+ * URI with `${AWS::URLSuffix}` issue #627).
54654
+ *
54655
+ * The `Fn::Join` arm routes through the shared
54656
+ * `tryResolveImageFnJoin` helper (`src/local/intrinsic-image.ts`) used
54657
+ * by `cdkd local invoke`. Like the sibling `lambda-resolver.ts`, we
54658
+ * pass `undefined` for the `ImageResolutionContext` — start-api
54659
+ * doesn't load cdkd state up front, so same-stack ECR refs surface
54660
+ * as `needs-state` and pseudo-parameter-only shapes (`Ref:
54661
+ * AWS::URLSuffix`) surface as `not-applicable`. Both cases throw a
54662
+ * clear error that names the actual root cause instead of falling
54663
+ * through to the ZIP branch's misleading "no Runtime" hard error.
54664
+ *
54665
+ * Pseudo-parameter substitution (`${AWS::URLSuffix}` → `amazonaws.com`)
54666
+ * is deliberately not implemented here — `lambda-resolver.ts` (the
54667
+ * canonical sibling) also defers it, and shipping one-sided support
54668
+ * would surprise users. Tracked separately as the issue's optional
54669
+ * follow-up.
54653
54670
  *
54654
54671
  * Returns `undefined` when the field is absent or non-recognized,
54655
54672
  * which routes the caller to the ZIP branch (with its existing
54656
54673
  * "no Runtime / no Handler" validations).
54657
54674
  */
54658
- function extractImageUri(value) {
54675
+ function extractImageUri(value, logicalId, stackName, resources) {
54659
54676
  if (typeof value === "string" && value.length > 0) return value;
54660
54677
  if (value && typeof value === "object" && !Array.isArray(value)) {
54661
- const sub = value["Fn::Sub"];
54678
+ const obj = value;
54679
+ const sub = obj["Fn::Sub"];
54662
54680
  if (typeof sub === "string" && sub.length > 0) return sub;
54663
54681
  if (Array.isArray(sub) && typeof sub[0] === "string") return sub[0];
54682
+ if ("Fn::Join" in obj) {
54683
+ const joinResolved = tryResolveImageFnJoin(value, resources, void 0);
54684
+ if (joinResolved.kind === "resolved") return joinResolved.uri;
54685
+ if (joinResolved.kind === "needs-state") throw new Error(`Lambda '${logicalId}' in ${stackName} references same-stack ECR repository '${joinResolved.repoLogicalId}' via Fn::Join. cdkd local start-api cannot resolve the repository URI without state — deploy the stack first (so cdkd records the repository physical id), rebuild via lambda.DockerImageCode.fromImageAsset, or pin a public image.`);
54686
+ if (joinResolved.kind === "unsupported-join") throw new Error(`Lambda '${logicalId}' in ${stackName} has an unsupported Fn::Join Code.ImageUri shape: ${joinResolved.reason}. cdkd local start-api recognizes the canonical CDK 2.x lambda.DockerImageCode.fromEcr Fn::Join shape (delimiter "" with nested Fn::Select/Fn::Split over an ECR Repository Arn GetAtt + Ref to the repo).`);
54687
+ throw new Error(`Lambda '${logicalId}' in ${stackName} has an Fn::Join Code.ImageUri that cdkd local start-api cannot resolve. The shape likely references AWS pseudo parameters (e.g. \${AWS::URLSuffix}) — the canonical CDK 2.x lambda.DockerImageCode.fromImageAsset synthesized shape. Workarounds: pin a fully-literal public image URI, or wait for the follow-up that substitutes \${AWS::URLSuffix} against the current region.`);
54688
+ }
54664
54689
  }
54665
54690
  }
54666
54691
  /**
@@ -59488,7 +59513,7 @@ function reorderArgs(argv) {
59488
59513
  */
59489
59514
  async function main() {
59490
59515
  const program = new Command();
59491
- program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.159.1");
59516
+ program.name("cdkd").description("CDK Direct - Deploy AWS CDK apps directly via SDK/Cloud Control API").version("0.159.3");
59492
59517
  program.addCommand(createBootstrapCommand());
59493
59518
  program.addCommand(createSynthCommand());
59494
59519
  program.addCommand(createListCommand());