cdk-local 0.18.0 → 0.19.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/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as createLocalStartApiCommand, i as createLocalRunTaskCommand, t as createLocalStartServiceCommand, z as createLocalInvokeCommand } from "./local-start-service-
|
|
2
|
+
import { a as createLocalStartApiCommand, i as createLocalRunTaskCommand, t as createLocalStartServiceCommand, z as createLocalInvokeCommand } from "./local-start-service-BnTZsZ8F.js";
|
|
3
3
|
import { Command } from "commander";
|
|
4
4
|
|
|
5
5
|
//#region src/cli/index.ts
|
|
6
6
|
const program = new Command();
|
|
7
|
-
program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.
|
|
7
|
+
program.name("cdkl").description("Run AWS CDK stacks locally with Docker.").version("0.19.0");
|
|
8
8
|
program.addCommand(createLocalInvokeCommand());
|
|
9
9
|
program.addCommand(createLocalStartApiCommand());
|
|
10
10
|
program.addCommand(createLocalRunTaskCommand());
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as buildConnectEvent, B as resolveRuntimeCodeMountPath, C as applyAuthorizerOverlay, D as buildMgmtEndpointEnvUrl, E as ConnectionRegistry, F as parseSelectionExpressionPath, G as createLocalStateProvider, H as resolveRuntimeImage, I as discoverRoutes, J as resolveCfnFallbackRegion, K as isCfnFlagPresent, L as pickRefLogicalId, M as buildMessageEvent, N as discoverWebSocketApis, O as handleConnectionsRequest, P as discoverWebSocketApisOrThrow, R as resolveLambdaArnIntrinsic, S as translateLambdaResponse, T as buildRestV1Event, U as resolveEnvVars, V as resolveRuntimeFileExtension, W as LocalStateSourceError, X as resolveCfnStackName, Y as resolveCfnRegion, Z as CfnLocalStateProvider, _ as computeRequestIdentityHash, a as createLocalStartApiCommand, b as invokeTokenAuthorizer, c as buildStageMap, d as buildCognitoJwksUrl, f as buildJwksUrlFromIssuer, g as buildMethodArn, h as verifyJwtAuthorizer, i as createLocalRunTaskCommand, j as buildDisconnectEvent, k as parseConnectionsPath, l as resolveSelectionExpression, m as verifyCognitoJwt, n as CloudMapRegistry, o as createAuthorizerCache, p as createJwksCache, q as rejectExplicitCfnStackWithMultipleStacks, r as getContainerNetworkIp, s as attachStageContext, t as createLocalStartServiceCommand, u as resolveServiceIntegrationParameters, v as evaluateCachedLambdaPolicy, w as buildHttpApiV2Event, x as matchRoute, y as invokeRequestAuthorizer, z as createLocalInvokeCommand } from "./local-start-service-
|
|
1
|
+
import { A as buildConnectEvent, B as resolveRuntimeCodeMountPath, C as applyAuthorizerOverlay, D as buildMgmtEndpointEnvUrl, E as ConnectionRegistry, F as parseSelectionExpressionPath, G as createLocalStateProvider, H as resolveRuntimeImage, I as discoverRoutes, J as resolveCfnFallbackRegion, K as isCfnFlagPresent, L as pickRefLogicalId, M as buildMessageEvent, N as discoverWebSocketApis, O as handleConnectionsRequest, P as discoverWebSocketApisOrThrow, R as resolveLambdaArnIntrinsic, S as translateLambdaResponse, T as buildRestV1Event, U as resolveEnvVars, V as resolveRuntimeFileExtension, W as LocalStateSourceError, X as resolveCfnStackName, Y as resolveCfnRegion, Z as CfnLocalStateProvider, _ as computeRequestIdentityHash, a as createLocalStartApiCommand, b as invokeTokenAuthorizer, c as buildStageMap, d as buildCognitoJwksUrl, f as buildJwksUrlFromIssuer, g as buildMethodArn, h as verifyJwtAuthorizer, i as createLocalRunTaskCommand, j as buildDisconnectEvent, k as parseConnectionsPath, l as resolveSelectionExpression, m as verifyCognitoJwt, n as CloudMapRegistry, o as createAuthorizerCache, p as createJwksCache, q as rejectExplicitCfnStackWithMultipleStacks, r as getContainerNetworkIp, s as attachStageContext, t as createLocalStartServiceCommand, u as resolveServiceIntegrationParameters, v as evaluateCachedLambdaPolicy, w as buildHttpApiV2Event, x as matchRoute, y as invokeRequestAuthorizer, z as createLocalInvokeCommand } from "./local-start-service-BnTZsZ8F.js";
|
|
2
2
|
|
|
3
3
|
export { CfnLocalStateProvider, CloudMapRegistry, ConnectionRegistry, LocalStateSourceError, applyAuthorizerOverlay, attachStageContext, buildCognitoJwksUrl, buildConnectEvent, buildDisconnectEvent, buildHttpApiV2Event, buildJwksUrlFromIssuer, buildMessageEvent, buildMethodArn, buildMgmtEndpointEnvUrl, buildRestV1Event, buildStageMap, computeRequestIdentityHash, createAuthorizerCache, createJwksCache, createLocalInvokeCommand, createLocalRunTaskCommand, createLocalStartApiCommand, createLocalStartServiceCommand, createLocalStateProvider, discoverRoutes, discoverWebSocketApis, discoverWebSocketApisOrThrow, evaluateCachedLambdaPolicy, getContainerNetworkIp, handleConnectionsRequest, invokeRequestAuthorizer, invokeTokenAuthorizer, isCfnFlagPresent, matchRoute, parseConnectionsPath, parseSelectionExpressionPath, pickRefLogicalId, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, resolveCfnRegion, resolveCfnStackName, resolveEnvVars, resolveLambdaArnIntrinsic, resolveRuntimeCodeMountPath, resolveRuntimeFileExtension, resolveRuntimeImage, resolveSelectionExpression, resolveServiceIntegrationParameters, translateLambdaResponse, verifyCognitoJwt, verifyJwtAuthorizer };
|
|
@@ -17997,7 +17997,9 @@ async function watchReplica(service, options, instance, runState) {
|
|
|
17997
17997
|
}
|
|
17998
17998
|
if (instance.shuttingDown || runState.shuttingDown) return;
|
|
17999
17999
|
logger.warn(`Replica ${instance.index} essential container exited with code ${exitCode} (restartCount=${instance.restartCount}).`);
|
|
18000
|
-
|
|
18000
|
+
const willRestart = shouldRestart(exitCode, options.restartPolicy);
|
|
18001
|
+
if (!willRestart || instance.restartCount === 0) await printExitedContainerLogs(instance.index, essentialId, logger);
|
|
18002
|
+
if (!willRestart) {
|
|
18001
18003
|
logger.warn(`Replica ${instance.index} not restarting (policy=${options.restartPolicy}, exit=${exitCode}). Service running in degraded mode.`);
|
|
18002
18004
|
instance.shuttingDown = true;
|
|
18003
18005
|
return;
|
|
@@ -18060,6 +18062,48 @@ const defaultWaitForExitImpl = async (containerId) => {
|
|
|
18060
18062
|
* test-overridable function so unit tests do not need a real container.
|
|
18061
18063
|
*/
|
|
18062
18064
|
let waitForExitImpl = defaultWaitForExitImpl;
|
|
18065
|
+
/** How many trailing lines of a crashed container's logs to surface. */
|
|
18066
|
+
const EXIT_LOG_TAIL_LINES = 50;
|
|
18067
|
+
/**
|
|
18068
|
+
* Production `docker logs --tail <N> <id>` reader. Captures BOTH streams
|
|
18069
|
+
* (apps log to stdout and stderr) so the surfaced tail shows whatever the
|
|
18070
|
+
* container printed before exiting.
|
|
18071
|
+
*/
|
|
18072
|
+
const defaultReadContainerLogsImpl = async (containerId) => {
|
|
18073
|
+
const { execFile } = await import("node:child_process");
|
|
18074
|
+
const { promisify } = await import("node:util");
|
|
18075
|
+
const { getDockerCmd } = await import("./docker-cmd-o4ovyAhR.js").then((n) => n.t);
|
|
18076
|
+
const { stdout, stderr } = await promisify(execFile)(getDockerCmd(), [
|
|
18077
|
+
"logs",
|
|
18078
|
+
"--tail",
|
|
18079
|
+
String(EXIT_LOG_TAIL_LINES),
|
|
18080
|
+
containerId
|
|
18081
|
+
], { maxBuffer: 4 * 1024 * 1024 });
|
|
18082
|
+
return [stdout, stderr].filter((s) => s.length > 0).join("\n");
|
|
18083
|
+
};
|
|
18084
|
+
/**
|
|
18085
|
+
* Surface the tail of a just-exited essential container's logs so the
|
|
18086
|
+
* user sees WHY it stopped (e.g. an app's startup DB-connection error)
|
|
18087
|
+
* without manually running `docker logs`. Best-effort: a read failure or
|
|
18088
|
+
* empty output is swallowed (debug-logged) rather than masking the
|
|
18089
|
+
* primary exit message.
|
|
18090
|
+
*
|
|
18091
|
+
* `read` is injectable so the unit test can assert the formatting without
|
|
18092
|
+
* a real container; production callers use the default `docker logs`
|
|
18093
|
+
* reader.
|
|
18094
|
+
*/
|
|
18095
|
+
async function printExitedContainerLogs(replicaIndex, containerId, logger, read = defaultReadContainerLogsImpl) {
|
|
18096
|
+
let raw;
|
|
18097
|
+
try {
|
|
18098
|
+
raw = await read(containerId);
|
|
18099
|
+
} catch (err) {
|
|
18100
|
+
logger.debug(`Replica ${replicaIndex}: could not read container logs: ${err instanceof Error ? err.message : String(err)}`);
|
|
18101
|
+
return;
|
|
18102
|
+
}
|
|
18103
|
+
const tail = raw.trimEnd();
|
|
18104
|
+
if (tail.length === 0) return;
|
|
18105
|
+
logger.warn(`Replica ${replicaIndex} essential container logs (last ${EXIT_LOG_TAIL_LINES} lines):\n${tail}`);
|
|
18106
|
+
}
|
|
18063
18107
|
const defaultSleepImpl = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
18064
18108
|
let sleepImpl = defaultSleepImpl;
|
|
18065
18109
|
function sleep(ms) {
|
|
@@ -18738,4 +18782,4 @@ function createLocalStartServiceCommand(opts = {}) {
|
|
|
18738
18782
|
|
|
18739
18783
|
//#endregion
|
|
18740
18784
|
export { buildConnectEvent as A, resolveRuntimeCodeMountPath as B, applyAuthorizerOverlay as C, buildMgmtEndpointEnvUrl as D, ConnectionRegistry as E, parseSelectionExpressionPath as F, createLocalStateProvider as G, resolveRuntimeImage as H, discoverRoutes as I, resolveCfnFallbackRegion as J, isCfnFlagPresent as K, pickRefLogicalId as L, buildMessageEvent as M, discoverWebSocketApis as N, handleConnectionsRequest as O, discoverWebSocketApisOrThrow as P, resolveLambdaArnIntrinsic as R, translateLambdaResponse as S, buildRestV1Event as T, resolveEnvVars as U, resolveRuntimeFileExtension as V, LocalStateSourceError as W, resolveCfnStackName as X, resolveCfnRegion as Y, CfnLocalStateProvider as Z, computeRequestIdentityHash as _, createLocalStartApiCommand as a, invokeTokenAuthorizer as b, buildStageMap as c, buildCognitoJwksUrl as d, buildJwksUrlFromIssuer as f, buildMethodArn as g, verifyJwtAuthorizer as h, createLocalRunTaskCommand as i, buildDisconnectEvent as j, parseConnectionsPath as k, resolveSelectionExpression as l, verifyCognitoJwt as m, CloudMapRegistry as n, createAuthorizerCache as o, createJwksCache as p, rejectExplicitCfnStackWithMultipleStacks as q, getContainerNetworkIp as r, attachStageContext as s, createLocalStartServiceCommand as t, resolveServiceIntegrationParameters as u, evaluateCachedLambdaPolicy as v, buildHttpApiV2Event as w, matchRoute as x, invokeRequestAuthorizer as y, createLocalInvokeCommand as z };
|
|
18741
|
-
//# sourceMappingURL=local-start-service-
|
|
18785
|
+
//# sourceMappingURL=local-start-service-BnTZsZ8F.js.map
|