@go-to-k/cdkd 0.30.1 → 0.31.0
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/README.md +25 -6
- package/dist/cli.js +238 -47
- package/dist/cli.js.map +3 -3
- package/dist/go-to-k-cdkd-0.31.0.tgz +0 -0
- package/dist/index.js +50 -1
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/go-to-k-cdkd-0.30.1.tgz +0 -0
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -6754,7 +6754,11 @@ Error: ${err.message || "Unknown error"}`,
|
|
|
6754
6754
|
};
|
|
6755
6755
|
|
|
6756
6756
|
// src/provisioning/providers/custom-resource-provider.ts
|
|
6757
|
-
import {
|
|
6757
|
+
import {
|
|
6758
|
+
InvokeCommand,
|
|
6759
|
+
waitUntilFunctionActiveV2,
|
|
6760
|
+
waitUntilFunctionUpdatedV2
|
|
6761
|
+
} from "@aws-sdk/client-lambda";
|
|
6758
6762
|
import { PublishCommand } from "@aws-sdk/client-sns";
|
|
6759
6763
|
import {
|
|
6760
6764
|
S3Client as S3Client6,
|
|
@@ -7038,9 +7042,54 @@ var CustomResourceProvider = class _CustomResourceProvider {
|
|
|
7038
7042
|
await this.publishToSns(serviceToken, request);
|
|
7039
7043
|
return await this.pollS3Response(responseKey, logicalId, operation);
|
|
7040
7044
|
}
|
|
7045
|
+
await this.waitForBackingLambdaReady(serviceToken, logicalId);
|
|
7041
7046
|
const response = await this.invokeLambda(serviceToken, request);
|
|
7042
7047
|
return await this.getCustomResourceResponse(response, responseKey, logicalId, operation);
|
|
7043
7048
|
}
|
|
7049
|
+
/**
|
|
7050
|
+
* Block until the backing Lambda function for a Custom Resource is in a
|
|
7051
|
+
* state that accepts a synchronous Invoke.
|
|
7052
|
+
*
|
|
7053
|
+
* Two sequential waiters:
|
|
7054
|
+
* 1. `waitUntilFunctionActiveV2` — handles the post-CreateFunction
|
|
7055
|
+
* `Pending` window (image pull, VPC ENI attachment, layer init).
|
|
7056
|
+
* 2. `waitUntilFunctionUpdatedV2` — handles the post-Update
|
|
7057
|
+
* `InProgress` window (configuration / code swap settling).
|
|
7058
|
+
* Together they cover the only two transient states that reject
|
|
7059
|
+
* synchronous Invokes.
|
|
7060
|
+
*
|
|
7061
|
+
* In the common case (Lambda has been Active for a while, no in-flight
|
|
7062
|
+
* Update), both waiters return on first poll → ~2 GetFunction calls →
|
|
7063
|
+
* ~200ms overhead. That's the price for correctness; the alternative
|
|
7064
|
+
* (whole-stack Active wait at Lambda CREATE) is ~5–10 minutes per
|
|
7065
|
+
* VPC-attached function.
|
|
7066
|
+
*
|
|
7067
|
+
* `serviceToken` is the Lambda function ARN; the Lambda SDK accepts
|
|
7068
|
+
* both name and ARN as `FunctionName`, so we pass the ARN through
|
|
7069
|
+
* unchanged.
|
|
7070
|
+
*
|
|
7071
|
+
* `maxWaitTime` is set generously (10 min) because VPC ENI attachment
|
|
7072
|
+
* has been observed to take 8+ minutes in pathological cases. The
|
|
7073
|
+
* deploy engine's per-resource `--resource-timeout` (default 30 min)
|
|
7074
|
+
* still bounds the outer Custom Resource provisioning attempt, so
|
|
7075
|
+
* this waiter cap is layered defense, not the only timeout.
|
|
7076
|
+
*/
|
|
7077
|
+
async waitForBackingLambdaReady(serviceToken, logicalId) {
|
|
7078
|
+
try {
|
|
7079
|
+
await waitUntilFunctionActiveV2(
|
|
7080
|
+
{ client: this.lambdaClient, maxWaitTime: 600 },
|
|
7081
|
+
{ FunctionName: serviceToken }
|
|
7082
|
+
);
|
|
7083
|
+
await waitUntilFunctionUpdatedV2(
|
|
7084
|
+
{ client: this.lambdaClient, maxWaitTime: 600 },
|
|
7085
|
+
{ FunctionName: serviceToken }
|
|
7086
|
+
);
|
|
7087
|
+
} catch (error) {
|
|
7088
|
+
throw new Error(
|
|
7089
|
+
`Lambda backing custom resource ${logicalId} (${serviceToken}) did not reach a ready state for Invoke: ${error instanceof Error ? error.message : String(error)}`
|
|
7090
|
+
);
|
|
7091
|
+
}
|
|
7092
|
+
}
|
|
7044
7093
|
/**
|
|
7045
7094
|
* Publish custom resource request to an SNS topic
|
|
7046
7095
|
*/
|