cdk-local 0.12.0 → 0.13.1
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 +6 -5
- package/dist/cli.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{local-start-service-D7VpREhn.js → local-start-service-C1AHpRo-.js} +227 -75
- package/dist/local-start-service-C1AHpRo-.js.map +1 -0
- package/package.json +1 -1
- package/dist/local-start-service-D7VpREhn.js.map +0 -1
package/README.md
CHANGED
|
@@ -161,18 +161,19 @@ Use this for production debugging, integration verification with real AWS resour
|
|
|
161
161
|
|
|
162
162
|
## `--watch` (hot reload)
|
|
163
163
|
|
|
164
|
-
Pass `--watch` to `cdkl start-api` and the server hot-reloads when your CDK app's
|
|
164
|
+
Pass `--watch` to `cdkl start-api` and the server re-synths and hot-reloads when your CDK app's **source** changes — edit a handler or construct, save, and the change is live:
|
|
165
165
|
|
|
166
166
|
```bash
|
|
167
167
|
cdkl start-api MyStack/MyApi --watch
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
- 500 ms debounced [chokidar](https://github.com/paulmillr/chokidar) file watcher on `cdk.
|
|
171
|
-
-
|
|
170
|
+
- 500 ms debounced [chokidar](https://github.com/paulmillr/chokidar) file watcher on your CDK app's source tree (the directory holding `cdk.json`). Honors `cdk.json`'s `watch.include` / `watch.exclude` globs, exactly like `cdk watch`.
|
|
171
|
+
- `cdk.out/`, `node_modules`, and `.git` are always excluded — the reload's own re-synth writes to `cdk.out/` never re-trigger the watcher, so there is no reload loop.
|
|
172
|
+
- Re-synths and re-discovers routes on each firing — adding a new route to your CDK app shows up locally on save. No separate `cdk watch` / `cdk synth` process is needed.
|
|
172
173
|
- Synth failures keep the previous version serving (warn-and-continue, never crashes the server).
|
|
173
|
-
- Compatible with `--from-cfn-stack`: each reload re-reads the deployed CloudFormation stack so
|
|
174
|
+
- Compatible with `--from-cfn-stack`: each reload re-reads the deployed CloudFormation stack so newly-deployed ARNs are picked up on your next source save without restarting the server.
|
|
174
175
|
|
|
175
|
-
See [docs/local-emulation.md](docs/local-emulation.md#hot-reload---watch) for the full lifecycle,
|
|
176
|
+
See [docs/local-emulation.md](docs/local-emulation.md#hot-reload---watch) for the full lifecycle, `watch.include` / `watch.exclude` semantics, and known limitations.
|
|
176
177
|
|
|
177
178
|
## Override env vars without a state source
|
|
178
179
|
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { i as createLocalStartApiCommand, k as createLocalInvokeCommand, r as createLocalRunTaskCommand, t as createLocalStartServiceCommand } from "./local-start-service-
|
|
2
|
+
import { i as createLocalStartApiCommand, k as createLocalInvokeCommand, r as createLocalRunTaskCommand, t as createLocalStartServiceCommand } from "./local-start-service-C1AHpRo-.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.13.1");
|
|
8
8
|
program.addCommand(createLocalInvokeCommand());
|
|
9
9
|
program.addCommand(createLocalStartApiCommand());
|
|
10
10
|
program.addCommand(createLocalRunTaskCommand());
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/state.ts","../src/local/state-resolver.ts","../src/local/local-state-provider.ts","../src/cli/commands/local-state-source.ts","../src/local/embed-config.ts","../src/types/resource.ts","../src/synthesis/assembly-reader.ts","../src/cli/commands/local-invoke.ts","../src/local/httpv2-service-integration.ts","../src/local/container-pool.ts","../src/local/integration-response-selector.ts","../src/local/rest-v1-integrations.ts","../src/local/route-discovery.ts","../src/local/authorizer-resolver.ts","../src/local/authorizer-cache.ts","../src/local/cognito-jwt.ts","../src/cli/commands/local-start-api.ts","../src/cli/commands/local-run-task.ts","../src/cli/commands/local-start-service.ts","../src/local/cfn-local-state-provider.ts","../src/local/intrinsic-utils.ts","../src/local/intrinsic-lambda-arn.ts","../src/local/parameter-mapping.ts","../src/local/api-gateway-response.ts","../src/local/docker-inspect.ts","../src/local/route-matcher.ts","../src/local/api-gateway-event.ts","../src/local/websocket-route-discovery.ts","../src/local/lambda-authorizer.ts"],"mappings":";;;;UAuLiB,aAAA;EAEf,UAAA;EAGA,YAAA;EAGA,UAAA,EAAY,MAAA;EAcZ,kBAAA,GAAqB,MAAA;EAGrB,UAAA,GAAa,MAAA;EAGb,YAAA;EAGA,QAAA,GAAW,MAAA;EAmBX,cAAA;EAMA,mBAAA;EAyBA,aAAA;AAAA;;;UCxIe,gBAAA;EACf,SAAA;EACA,MAAA;EACA,SAAA;EACA,SAAA;AAAA;AAAA,UAqBe,kBAAA;EAOf,aAAA,CAAc,UAAA,WAAqB,OAAA;EAQnC,qBAAA,CACE,aAAA,UACA,cAAA,UACA,UAAA,WACC,OAAA;AAAA;AAAA,UAGY,mBAAA;EAEf,SAAA,EAAW,MAAA,SAAe,aAAA;EAE1B,gBAAA,GAAmB,gBAAA;EAOnB,kBAAA,GAAqB,kBAAA;EAOrB,cAAA;AAAA;;;UCrJe,gBAAA;EAWf,SAAA,EAAW,MAAA,SAAe,aAAA;EAO1B,OAAA,EAAS,MAAA;EAOT,MAAA;AAAA;AAAA,UAsBe,kBAAA;EAAA,SAMN,KAAA;EAQT,IAAA,CAAK,SAAA,UAAmB,WAAA,uBAAkC,OAAA,CAAQ,gBAAA;EAalE,uBAAA,CAAwB,cAAA,WAAyB,OAAA,CAAQ,kBAAA;EA4BzD,0BAAA,EACE,kBAAA,WACC,OAAA,CAAQ,MAAA;EAKX,OAAA;AAAA;;;UC7Ge,uBAAA;EAOf,YAAA;EAEA,MAAA;EAEA,OAAA;EAMA,WAAA;EAAA,CAEC,GAAA;AAAA;AAAA,KAQS,yBAAA,IAA6B,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/types/state.ts","../src/local/state-resolver.ts","../src/local/local-state-provider.ts","../src/cli/commands/local-state-source.ts","../src/local/embed-config.ts","../src/types/resource.ts","../src/synthesis/assembly-reader.ts","../src/cli/commands/local-invoke.ts","../src/local/httpv2-service-integration.ts","../src/local/container-pool.ts","../src/local/integration-response-selector.ts","../src/local/rest-v1-integrations.ts","../src/local/route-discovery.ts","../src/local/authorizer-resolver.ts","../src/local/authorizer-cache.ts","../src/local/cognito-jwt.ts","../src/cli/commands/local-start-api.ts","../src/cli/commands/local-run-task.ts","../src/cli/commands/local-start-service.ts","../src/local/cfn-local-state-provider.ts","../src/local/intrinsic-utils.ts","../src/local/intrinsic-lambda-arn.ts","../src/local/parameter-mapping.ts","../src/local/api-gateway-response.ts","../src/local/docker-inspect.ts","../src/local/route-matcher.ts","../src/local/api-gateway-event.ts","../src/local/websocket-route-discovery.ts","../src/local/lambda-authorizer.ts"],"mappings":";;;;UAuLiB,aAAA;EAEf,UAAA;EAGA,YAAA;EAGA,UAAA,EAAY,MAAA;EAcZ,kBAAA,GAAqB,MAAA;EAGrB,UAAA,GAAa,MAAA;EAGb,YAAA;EAGA,QAAA,GAAW,MAAA;EAmBX,cAAA;EAMA,mBAAA;EAyBA,aAAA;AAAA;;;UCxIe,gBAAA;EACf,SAAA;EACA,MAAA;EACA,SAAA;EACA,SAAA;AAAA;AAAA,UAqBe,kBAAA;EAOf,aAAA,CAAc,UAAA,WAAqB,OAAA;EAQnC,qBAAA,CACE,aAAA,UACA,cAAA,UACA,UAAA,WACC,OAAA;AAAA;AAAA,UAGY,mBAAA;EAEf,SAAA,EAAW,MAAA,SAAe,aAAA;EAE1B,gBAAA,GAAmB,gBAAA;EAOnB,kBAAA,GAAqB,kBAAA;EAOrB,cAAA;AAAA;;;UCrJe,gBAAA;EAWf,SAAA,EAAW,MAAA,SAAe,aAAA;EAO1B,OAAA,EAAS,MAAA;EAOT,MAAA;AAAA;AAAA,UAsBe,kBAAA;EAAA,SAMN,KAAA;EAQT,I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A;EACA,IAAA;AAAA;AAAA,iBAoBoB,qBAAA,CACpB,UAAA,EAAY,qBAAA,EACZ,OAAA,EAAS,4BAAA,EACT,GAAA,EAAK,2BAAA,GACJ,OAAA,CAAQ,sBAAA;EAA2B,YAAA;AAAA;AAAA,iBAyBhB,uBAAA,CACpB,UAAA,EAAY,uBAAA,EACZ,OAAA,EAAS,4BAAA,EACT,GAAA,EAAK,2BAAA,GACJ,OAAA,CAAQ,sBAAA;EAA2B,YAAA;AAAA;AAAA,iBAyEtB,0BAAA,CACd,UAAA,EAAY,uBAAA,EACZ,OAAA,EAAS,4BAAA;EACN,YAAA;EAAsB,OAAA;AAAA;AAAA,iBAmRX,0BAAA,CACd,MAAA,EAAQ,sBAAA,EACR,SAAA,WACC,sBAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as LocalStateSourceError, C as discoverWebSocketApis, D as pickRefLogicalId, E as discoverRoutes, F as resolveCfnRegion, I as resolveCfnStackName, L as CfnLocalStateProvider, M as isCfnFlagPresent, N as rejectExplicitCfnStackWithMultipleStacks, O as resolveLambdaArnIntrinsic, P as resolveCfnFallbackRegion, S as buildRestV1Event, T as parseSelectionExpressionPath, _ as invokeTokenAuthorizer, a as createAuthorizerCache, b as applyAuthorizerOverlay, c as buildCognitoJwksUrl, d as verifyCognitoJwt, f as verifyJwtAuthorizer, g as invokeRequestAuthorizer, h as evaluateCachedLambdaPolicy, i as createLocalStartApiCommand, j as createLocalStateProvider, k as createLocalInvokeCommand, l as buildJwksUrlFromIssuer, m as computeRequestIdentityHash, n as getContainerNetworkIp, o as resolveSelectionExpression, p as buildMethodArn, r as createLocalRunTaskCommand, s as resolveServiceIntegrationParameters, t as createLocalStartServiceCommand, u as createJwksCache, v as matchRoute, w as discoverWebSocketApisOrThrow, x as buildHttpApiV2Event, y as translateLambdaResponse } from "./local-start-service-
|
|
1
|
+
import { A as LocalStateSourceError, C as discoverWebSocketApis, D as pickRefLogicalId, E as discoverRoutes, F as resolveCfnRegion, I as resolveCfnStackName, L as CfnLocalStateProvider, M as isCfnFlagPresent, N as rejectExplicitCfnStackWithMultipleStacks, O as resolveLambdaArnIntrinsic, P as resolveCfnFallbackRegion, S as buildRestV1Event, T as parseSelectionExpressionPath, _ as invokeTokenAuthorizer, a as createAuthorizerCache, b as applyAuthorizerOverlay, c as buildCognitoJwksUrl, d as verifyCognitoJwt, f as verifyJwtAuthorizer, g as invokeRequestAuthorizer, h as evaluateCachedLambdaPolicy, i as createLocalStartApiCommand, j as createLocalStateProvider, k as createLocalInvokeCommand, l as buildJwksUrlFromIssuer, m as computeRequestIdentityHash, n as getContainerNetworkIp, o as resolveSelectionExpression, p as buildMethodArn, r as createLocalRunTaskCommand, s as resolveServiceIntegrationParameters, t as createLocalStartServiceCommand, u as createJwksCache, v as matchRoute, w as discoverWebSocketApisOrThrow, x as buildHttpApiV2Event, y as translateLambdaResponse } from "./local-start-service-C1AHpRo-.js";
|
|
2
2
|
|
|
3
3
|
export { CfnLocalStateProvider, LocalStateSourceError, applyAuthorizerOverlay, buildCognitoJwksUrl, buildHttpApiV2Event, buildJwksUrlFromIssuer, buildMethodArn, buildRestV1Event, computeRequestIdentityHash, createAuthorizerCache, createJwksCache, createLocalInvokeCommand, createLocalRunTaskCommand, createLocalStartApiCommand, createLocalStartServiceCommand, createLocalStateProvider, discoverRoutes, discoverWebSocketApis, discoverWebSocketApisOrThrow, evaluateCachedLambdaPolicy, getContainerNetworkIp, invokeRequestAuthorizer, invokeTokenAuthorizer, isCfnFlagPresent, matchRoute, parseSelectionExpressionPath, pickRefLogicalId, rejectExplicitCfnStackWithMultipleStacks, resolveCfnFallbackRegion, resolveCfnRegion, resolveCfnStackName, resolveLambdaArnIntrinsic, resolveSelectionExpression, resolveServiceIntegrationParameters, translateLambdaResponse, verifyCognitoJwt, verifyJwtAuthorizer };
|
|
@@ -411,6 +411,9 @@ function loadCdkJson() {
|
|
|
411
411
|
return null;
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
+
function normalizeGlobList(value) {
|
|
415
|
+
return (typeof value === "string" ? [value] : Array.isArray(value) ? value : []).filter((entry) => typeof entry === "string" && entry.length > 0);
|
|
416
|
+
}
|
|
414
417
|
/**
|
|
415
418
|
* Resolve the `--app` option from CLI, `CDKL_APP` env var, or `cdk.json`.
|
|
416
419
|
*
|
|
@@ -428,6 +431,26 @@ function resolveApp(cliApp) {
|
|
|
428
431
|
if (envApp) return envApp;
|
|
429
432
|
return loadCdkJson()?.app ?? void 0;
|
|
430
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Resolve the `cdk.json` `watch` block, mirroring `cdk watch`'s
|
|
436
|
+
* include / exclude semantics for `cdkl start-api --watch` source-tree
|
|
437
|
+
* watching.
|
|
438
|
+
*
|
|
439
|
+
* Defaults when the keys are absent: `include` -> `['**']` (watch the
|
|
440
|
+
* whole app directory), `exclude` -> `[]`. Unlike `cdk watch`, a missing
|
|
441
|
+
* `watch` block is NOT an error — `--watch` still works against the
|
|
442
|
+
* defaults. The caller layers in mandatory excludes (the synth output
|
|
443
|
+
* directory, `node_modules`, `.git`) so re-synth writes never re-trigger
|
|
444
|
+
* a reload and large noise directories are pruned.
|
|
445
|
+
*/
|
|
446
|
+
function resolveWatchConfig() {
|
|
447
|
+
const watch = loadCdkJson()?.watch;
|
|
448
|
+
const include = normalizeGlobList(watch?.include);
|
|
449
|
+
return {
|
|
450
|
+
include: include.length > 0 ? include : ["**"],
|
|
451
|
+
exclude: normalizeGlobList(watch?.exclude)
|
|
452
|
+
};
|
|
453
|
+
}
|
|
431
454
|
|
|
432
455
|
//#endregion
|
|
433
456
|
//#region src/cli/cdk-path.ts
|
|
@@ -1295,6 +1318,12 @@ function resolveImageIntrinsicAny(node, resources, context) {
|
|
|
1295
1318
|
if (resources[logicalId]?.Type !== "AWS::ECR::Repository") return void 0;
|
|
1296
1319
|
const cached = context?.stateResources?.[logicalId]?.attributes?.[attr];
|
|
1297
1320
|
if (typeof cached === "string" && cached.length > 0) return cached;
|
|
1321
|
+
const physicalId = context?.stateResources?.[logicalId]?.physicalId;
|
|
1322
|
+
const p = context?.pseudoParameters;
|
|
1323
|
+
if (physicalId && p?.region && p.accountId) {
|
|
1324
|
+
if (attr === "Arn" && p.partition) return `arn:${p.partition}:ecr:${p.region}:${p.accountId}:repository/${physicalId}`;
|
|
1325
|
+
if (attr === "RepositoryUri" && p.urlSuffix) return `${p.accountId}.dkr.ecr.${p.region}.${p.urlSuffix}/${physicalId}`;
|
|
1326
|
+
}
|
|
1298
1327
|
return;
|
|
1299
1328
|
}
|
|
1300
1329
|
if (intrinsic === "Fn::Split") {
|
|
@@ -4337,10 +4366,13 @@ async function pullEcrImage(imageUri, options) {
|
|
|
4337
4366
|
await verifyImageInLocalCache(imageUri);
|
|
4338
4367
|
return imageUri;
|
|
4339
4368
|
}
|
|
4340
|
-
const callerIdentityKey = callerRegion ?? "_unset"
|
|
4369
|
+
const callerIdentityKey = `${options.profile ?? "_noprofile"}|${callerRegion ?? "_unset"}`;
|
|
4341
4370
|
let callerAccount = CALLER_IDENTITY_CACHE.get(callerIdentityKey);
|
|
4342
4371
|
if (callerAccount === void 0) {
|
|
4343
|
-
const sts = new STSClient({
|
|
4372
|
+
const sts = new STSClient({
|
|
4373
|
+
...callerRegion && { region: callerRegion },
|
|
4374
|
+
...options.profile && { profile: options.profile }
|
|
4375
|
+
});
|
|
4344
4376
|
try {
|
|
4345
4377
|
const identity = await sts.send(new GetCallerIdentityCommand({}));
|
|
4346
4378
|
if (!identity.Account) throw new LocalInvokeBuildError("STS GetCallerIdentity returned no Account. Verify your AWS credentials.");
|
|
@@ -4354,13 +4386,13 @@ async function pullEcrImage(imageUri, options) {
|
|
|
4354
4386
|
const crossRegion = callerRegion !== void 0 && callerRegion !== parsed.region;
|
|
4355
4387
|
let assumed;
|
|
4356
4388
|
if (options.ecrRoleArn) {
|
|
4357
|
-
const cacheKey = `${options.ecrRoleArn}|${callerRegion ?? "_unset"}`;
|
|
4389
|
+
const cacheKey = `${options.profile ?? "_noprofile"}|${options.ecrRoleArn}|${callerRegion ?? "_unset"}`;
|
|
4358
4390
|
const cached = ASSUMED_ROLE_CACHE.get(cacheKey);
|
|
4359
4391
|
if (cached && isCredentialFresh(cached)) {
|
|
4360
4392
|
assumed = cached;
|
|
4361
4393
|
logger.debug(`Reusing cached AssumeRole credentials for ${options.ecrRoleArn}`);
|
|
4362
4394
|
} else {
|
|
4363
|
-
assumed = await assumeRoleForEcr(options.ecrRoleArn, callerRegion, logger);
|
|
4395
|
+
assumed = await assumeRoleForEcr(options.ecrRoleArn, callerRegion, options.profile, logger);
|
|
4364
4396
|
ASSUMED_ROLE_CACHE.set(cacheKey, assumed);
|
|
4365
4397
|
logger.info(`Assumed role ${options.ecrRoleArn} for ECR pull (account=${parsed.accountId}, region=${parsed.region})`);
|
|
4366
4398
|
}
|
|
@@ -4368,7 +4400,7 @@ async function pullEcrImage(imageUri, options) {
|
|
|
4368
4400
|
if (crossRegion) logger.info(`Cross-region ECR pull: image region ${parsed.region} != caller ${callerRegion ?? "(unset)"}. Authenticating against the image region directly.`);
|
|
4369
4401
|
const ecr = new ECRClient({
|
|
4370
4402
|
region: parsed.region,
|
|
4371
|
-
...assumed
|
|
4403
|
+
...assumed ? { credentials: assumed } : options.profile ? { profile: options.profile } : {}
|
|
4372
4404
|
});
|
|
4373
4405
|
try {
|
|
4374
4406
|
await ecrLogin(ecr, parsed.accountId, parsed.region);
|
|
@@ -4390,9 +4422,12 @@ async function pullEcrImage(imageUri, options) {
|
|
|
4390
4422
|
* service so the region is informational, but threading it through
|
|
4391
4423
|
* mirrors the convention used by `src/utils/role-arn.ts`.
|
|
4392
4424
|
*/
|
|
4393
|
-
async function assumeRoleForEcr(roleArn, callerRegion, logger) {
|
|
4425
|
+
async function assumeRoleForEcr(roleArn, callerRegion, profile, logger) {
|
|
4394
4426
|
logger.debug(`Assuming role ${roleArn} for ECR pull...`);
|
|
4395
|
-
const sts = new STSClient({
|
|
4427
|
+
const sts = new STSClient({
|
|
4428
|
+
...callerRegion && { region: callerRegion },
|
|
4429
|
+
...profile && { profile }
|
|
4430
|
+
});
|
|
4396
4431
|
try {
|
|
4397
4432
|
const creds = (await sts.send(new AssumeRoleCommand({
|
|
4398
4433
|
RoleArn: roleArn,
|
|
@@ -5761,6 +5796,99 @@ function createLocalInvokeCommand(opts = {}) {
|
|
|
5761
5796
|
return invoke;
|
|
5762
5797
|
}
|
|
5763
5798
|
|
|
5799
|
+
//#endregion
|
|
5800
|
+
//#region src/utils/glob-match.ts
|
|
5801
|
+
/**
|
|
5802
|
+
* Normalize a glob and split it into path-segment tokens. Returns
|
|
5803
|
+
* `null` for an empty pattern (callers skip it). A slash-free pattern is
|
|
5804
|
+
* prefixed with a `**` token so it matches its basename at any depth.
|
|
5805
|
+
*/
|
|
5806
|
+
function compilePattern(glob) {
|
|
5807
|
+
const g = glob.replace(/\\/g, "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
5808
|
+
if (g === "") return null;
|
|
5809
|
+
if (!g.includes("/")) return ["**", g];
|
|
5810
|
+
return g.split("/");
|
|
5811
|
+
}
|
|
5812
|
+
/**
|
|
5813
|
+
* Linear wildcard match for ONE path segment (no `/`). `*` matches any
|
|
5814
|
+
* run of characters, `?` matches exactly one. Classic two-pointer
|
|
5815
|
+
* algorithm with single backtrack pointer — O(len(pat) * len(str)),
|
|
5816
|
+
* never exponential.
|
|
5817
|
+
*/
|
|
5818
|
+
function matchSegment(pat, str) {
|
|
5819
|
+
let s = 0;
|
|
5820
|
+
let p = 0;
|
|
5821
|
+
let starP = -1;
|
|
5822
|
+
let starS = 0;
|
|
5823
|
+
while (s < str.length) {
|
|
5824
|
+
const pc = pat[p];
|
|
5825
|
+
if (p < pat.length && (pc === str[s] || pc === "?")) {
|
|
5826
|
+
s++;
|
|
5827
|
+
p++;
|
|
5828
|
+
} else if (pc === "*") {
|
|
5829
|
+
starP = p;
|
|
5830
|
+
starS = s;
|
|
5831
|
+
p++;
|
|
5832
|
+
} else if (starP !== -1) {
|
|
5833
|
+
p = starP + 1;
|
|
5834
|
+
starS++;
|
|
5835
|
+
s = starS;
|
|
5836
|
+
} else return false;
|
|
5837
|
+
}
|
|
5838
|
+
while (pat[p] === "*") p++;
|
|
5839
|
+
return p === pat.length;
|
|
5840
|
+
}
|
|
5841
|
+
/**
|
|
5842
|
+
* Match a compiled pattern's segment tokens against a path's segments. A
|
|
5843
|
+
* `**` token matches zero or more path segments; every other token
|
|
5844
|
+
* matches exactly one segment via {@link matchSegment}. The pattern
|
|
5845
|
+
* matches when it consumes a PREFIX of the path (the contents rule), so
|
|
5846
|
+
* a directory pattern also matches everything beneath it. Single
|
|
5847
|
+
* backtrack pointer over `**` — O(patSegs * pathSegs), never
|
|
5848
|
+
* exponential.
|
|
5849
|
+
*/
|
|
5850
|
+
function matchSegments(pat, path) {
|
|
5851
|
+
let pi = 0;
|
|
5852
|
+
let si = 0;
|
|
5853
|
+
let starPi = -1;
|
|
5854
|
+
let starSi = 0;
|
|
5855
|
+
while (si < path.length) {
|
|
5856
|
+
if (pi === pat.length) return true;
|
|
5857
|
+
if (pat[pi] === "**") {
|
|
5858
|
+
starPi = pi;
|
|
5859
|
+
starSi = si;
|
|
5860
|
+
pi++;
|
|
5861
|
+
} else if (matchSegment(pat[pi], path[si])) {
|
|
5862
|
+
pi++;
|
|
5863
|
+
si++;
|
|
5864
|
+
} else if (starPi !== -1) {
|
|
5865
|
+
pi = starPi + 1;
|
|
5866
|
+
starSi++;
|
|
5867
|
+
si = starSi;
|
|
5868
|
+
} else return false;
|
|
5869
|
+
}
|
|
5870
|
+
if (pi === pat.length) return true;
|
|
5871
|
+
while (pi < pat.length && pat[pi] === "**") pi++;
|
|
5872
|
+
return pi === pat.length;
|
|
5873
|
+
}
|
|
5874
|
+
/**
|
|
5875
|
+
* Compile a list of globs into a single matcher. The returned predicate
|
|
5876
|
+
* is `true` when the (relative, POSIX-normalized) path matches ANY
|
|
5877
|
+
* pattern. An empty or all-invalid pattern list yields a matcher that
|
|
5878
|
+
* never matches.
|
|
5879
|
+
*/
|
|
5880
|
+
function createGlobMatcher(patterns) {
|
|
5881
|
+
const compiled = [];
|
|
5882
|
+
for (const p of patterns) {
|
|
5883
|
+
const segs = compilePattern(p);
|
|
5884
|
+
if (segs) compiled.push(segs);
|
|
5885
|
+
}
|
|
5886
|
+
return (relPath) => {
|
|
5887
|
+
const pathSegs = relPath.replace(/\\/g, "/").split("/");
|
|
5888
|
+
return compiled.some((pat) => matchSegments(pat, pathSegs));
|
|
5889
|
+
};
|
|
5890
|
+
}
|
|
5891
|
+
|
|
5764
5892
|
//#endregion
|
|
5765
5893
|
//#region src/local/intrinsic-lambda-arn.ts
|
|
5766
5894
|
/**
|
|
@@ -14308,7 +14436,8 @@ function createFileWatcher(options) {
|
|
|
14308
14436
|
const watcher = chokidar.watch([...options.paths], {
|
|
14309
14437
|
ignoreInitial,
|
|
14310
14438
|
followSymlinks: false,
|
|
14311
|
-
ignorePermissionErrors: true
|
|
14439
|
+
ignorePermissionErrors: true,
|
|
14440
|
+
...options.ignored && { ignored: options.ignored }
|
|
14312
14441
|
});
|
|
14313
14442
|
let timer = null;
|
|
14314
14443
|
let closed = false;
|
|
@@ -14326,34 +14455,24 @@ function createFileWatcher(options) {
|
|
|
14326
14455
|
}, debounceMs);
|
|
14327
14456
|
timer.unref?.();
|
|
14328
14457
|
};
|
|
14329
|
-
|
|
14330
|
-
|
|
14331
|
-
|
|
14458
|
+
const onEvent = (path) => {
|
|
14459
|
+
if (options.shouldTrigger && !options.shouldTrigger(path)) return;
|
|
14460
|
+
fire();
|
|
14461
|
+
};
|
|
14462
|
+
watcher.on("add", onEvent);
|
|
14463
|
+
watcher.on("change", onEvent);
|
|
14464
|
+
watcher.on("unlink", onEvent);
|
|
14332
14465
|
watcher.on("error", (err) => {
|
|
14333
14466
|
logger.debug(`chokidar error: ${err instanceof Error ? err.message : String(err)}. Continuing.`);
|
|
14334
14467
|
});
|
|
14335
|
-
|
|
14336
|
-
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
const toAdd = [];
|
|
14341
|
-
const toRemove = [];
|
|
14342
|
-
for (const p of next) if (!currentPaths.has(p)) toAdd.push(p);
|
|
14343
|
-
for (const p of currentPaths) if (!next.has(p)) toRemove.push(p);
|
|
14344
|
-
if (toAdd.length > 0) watcher.add(toAdd);
|
|
14345
|
-
if (toRemove.length > 0) watcher.unwatch(toRemove);
|
|
14346
|
-
currentPaths = next;
|
|
14347
|
-
},
|
|
14348
|
-
close: async () => {
|
|
14349
|
-
closed = true;
|
|
14350
|
-
if (timer) {
|
|
14351
|
-
clearTimeout(timer);
|
|
14352
|
-
timer = null;
|
|
14353
|
-
}
|
|
14354
|
-
await watcher.close();
|
|
14468
|
+
return { close: async () => {
|
|
14469
|
+
closed = true;
|
|
14470
|
+
if (timer) {
|
|
14471
|
+
clearTimeout(timer);
|
|
14472
|
+
timer = null;
|
|
14355
14473
|
}
|
|
14356
|
-
|
|
14474
|
+
await watcher.close();
|
|
14475
|
+
} };
|
|
14357
14476
|
}
|
|
14358
14477
|
|
|
14359
14478
|
//#endregion
|
|
@@ -14427,7 +14546,6 @@ async function localStartApiCommand(target, options, extraStateProviders) {
|
|
|
14427
14546
|
const inlineTmpDirs = /* @__PURE__ */ new Set();
|
|
14428
14547
|
const layerTmpDirs = /* @__PURE__ */ new Set();
|
|
14429
14548
|
let profileCredsFile;
|
|
14430
|
-
const lastAssetPaths = { value: [] };
|
|
14431
14549
|
const authorizerCache = createAuthorizerCache();
|
|
14432
14550
|
const jwksCache = createJwksCache();
|
|
14433
14551
|
const jwksWarnedUrls = /* @__PURE__ */ new Set();
|
|
@@ -14556,30 +14674,7 @@ async function localStartApiCommand(target, options, extraStateProviders) {
|
|
|
14556
14674
|
});
|
|
14557
14675
|
return pool;
|
|
14558
14676
|
};
|
|
14559
|
-
/**
|
|
14560
|
-
* Compute the watched-asset list from a spec map. Pure helper —
|
|
14561
|
-
* keeps the side-effect (`lastAssetPaths.value = ...`) confined to
|
|
14562
|
-
* the post-swap call sites (initial boot + post-reload). For ZIP
|
|
14563
|
-
* Lambdas `codeDir` is either the unzipped asset directory or the
|
|
14564
|
-
* inline-code tmpdir; both are watch-worthy. IMAGE Lambdas
|
|
14565
|
-
* (`kind: 'image'`) don't have a host-side bind-mount source — the
|
|
14566
|
-
* code is baked into the docker image at build time. Their build
|
|
14567
|
-
* context (Dockerfile + source directory) is rebuilt on every
|
|
14568
|
-
* reload via `synthesizeAndBuild` → `buildContainerSpec` →
|
|
14569
|
-
* `resolveContainerImageForStartApi`, so a source edit DOES trigger
|
|
14570
|
-
* rebuild AND the deterministic `image` tag changes — but watching
|
|
14571
|
-
* the build-context dir explicitly here is deferred to a follow-up
|
|
14572
|
-
* (the watched-asset list is currently sourced from `cdk.out/`
|
|
14573
|
-
* which transitively covers most container-Lambda asset dirs since
|
|
14574
|
-
* `cdk synth` re-stages them on every synth call).
|
|
14575
|
-
*/
|
|
14576
|
-
const computeAssetPaths = (specs) => {
|
|
14577
|
-
const assetPaths = /* @__PURE__ */ new Set();
|
|
14578
|
-
for (const spec of specs.values()) if (spec.kind === "zip") assetPaths.add(spec.codeDir);
|
|
14579
|
-
return [...assetPaths];
|
|
14580
|
-
};
|
|
14581
14677
|
const initialMaterial = await synthesizeAndBuild();
|
|
14582
|
-
lastAssetPaths.value = computeAssetPaths(initialMaterial.specs);
|
|
14583
14678
|
await prewarmJwks(initialMaterial.routes, jwksCache);
|
|
14584
14679
|
warnVpcConfigLambdas(initialMaterial.routes, initialMaterial.stacks ?? []);
|
|
14585
14680
|
sigV4CredentialsLoader = defaultCredentialsLoader();
|
|
@@ -14720,23 +14815,27 @@ async function localStartApiCommand(target, options, extraStateProviders) {
|
|
|
14720
14815
|
let watcher;
|
|
14721
14816
|
let reloadChain = Promise.resolve();
|
|
14722
14817
|
if (options.watch) {
|
|
14818
|
+
const watchRoot = process.cwd();
|
|
14819
|
+
const { ignored, shouldTrigger, excludePatterns } = createWatchPredicates({
|
|
14820
|
+
watchRoot,
|
|
14821
|
+
output: options.output,
|
|
14822
|
+
watchConfig: resolveWatchConfig()
|
|
14823
|
+
});
|
|
14723
14824
|
watcher = createFileWatcher({
|
|
14724
|
-
paths: [
|
|
14825
|
+
paths: [watchRoot],
|
|
14826
|
+
ignored,
|
|
14827
|
+
shouldTrigger,
|
|
14725
14828
|
onChange: () => {
|
|
14726
|
-
logger.info("Detected
|
|
14829
|
+
logger.info("Detected source change; reloading...");
|
|
14727
14830
|
reloadChain = reloadChain.then(() => reloadAllServers({
|
|
14728
14831
|
synthesizeAndBuild,
|
|
14729
14832
|
servers,
|
|
14730
14833
|
buildPool,
|
|
14731
|
-
computeAssetPaths,
|
|
14732
|
-
lastAssetPaths,
|
|
14733
|
-
watcher,
|
|
14734
|
-
output: options.output,
|
|
14735
14834
|
logger
|
|
14736
14835
|
})).catch(() => void 0);
|
|
14737
14836
|
}
|
|
14738
14837
|
});
|
|
14739
|
-
logger.info(`Watching ${
|
|
14838
|
+
logger.info(`Watching ${watchRoot} for source changes (excluding ${excludePatterns.join(", ")}).`);
|
|
14740
14839
|
}
|
|
14741
14840
|
let shutdownStarted = false;
|
|
14742
14841
|
let firstSignal;
|
|
@@ -14838,6 +14937,52 @@ async function localStartApiCommand(target, options, extraStateProviders) {
|
|
|
14838
14937
|
await new Promise(() => void 0);
|
|
14839
14938
|
}
|
|
14840
14939
|
/**
|
|
14940
|
+
* Build the `--watch` file-watcher predicates for a source tree rooted
|
|
14941
|
+
* at `watchRoot` (the synth working directory).
|
|
14942
|
+
*
|
|
14943
|
+
* The synth output directory is always excluded so the reload's own
|
|
14944
|
+
* re-synth writes never re-trigger the watcher (no loop); `node_modules`
|
|
14945
|
+
* / `.git` are excluded for traversal cost. `cdk.json` `watch.exclude`
|
|
14946
|
+
* globs layer on top, and `watch.include` gates which changes fire a
|
|
14947
|
+
* reload. The output dir is only added as a glob when it lives UNDER the
|
|
14948
|
+
* watch root — when it equals the root (`''`) or sits outside it
|
|
14949
|
+
* (`..`-prefixed), a watcher rooted at `watchRoot` never traverses it,
|
|
14950
|
+
* so no exclude entry is needed (and a `''` / `..` glob is meaningless).
|
|
14951
|
+
*
|
|
14952
|
+
* `@internal` exported for unit tests (the exclude/include composition +
|
|
14953
|
+
* the output-dir relativization edge cases).
|
|
14954
|
+
*/
|
|
14955
|
+
function createWatchPredicates(args) {
|
|
14956
|
+
const { watchRoot, output, watchConfig } = args;
|
|
14957
|
+
const toRel = (abs) => path.relative(watchRoot, abs).split(path.sep).join("/");
|
|
14958
|
+
const outputRel = toRel(path.resolve(watchRoot, output));
|
|
14959
|
+
const excludePatterns = [
|
|
14960
|
+
...outputRel !== "" && !outputRel.startsWith("..") ? [outputRel] : [],
|
|
14961
|
+
"node_modules",
|
|
14962
|
+
".git",
|
|
14963
|
+
...watchConfig.exclude
|
|
14964
|
+
];
|
|
14965
|
+
const excludeMatcher = createGlobMatcher(excludePatterns);
|
|
14966
|
+
const includeMatcher = createGlobMatcher(watchConfig.include);
|
|
14967
|
+
const ignored = (absPath) => {
|
|
14968
|
+
const rel = toRel(absPath);
|
|
14969
|
+
if (rel === "") return false;
|
|
14970
|
+
if (rel.startsWith("..")) return true;
|
|
14971
|
+
return excludeMatcher(rel);
|
|
14972
|
+
};
|
|
14973
|
+
const shouldTrigger = (absPath) => {
|
|
14974
|
+
const rel = toRel(absPath);
|
|
14975
|
+
if (rel === "" || rel.startsWith("..")) return false;
|
|
14976
|
+
if (excludeMatcher(rel)) return false;
|
|
14977
|
+
return includeMatcher(rel);
|
|
14978
|
+
};
|
|
14979
|
+
return {
|
|
14980
|
+
ignored,
|
|
14981
|
+
shouldTrigger,
|
|
14982
|
+
excludePatterns
|
|
14983
|
+
};
|
|
14984
|
+
}
|
|
14985
|
+
/**
|
|
14841
14986
|
* Match the `--stack` pattern (or single-stack auto-detect) to a list
|
|
14842
14987
|
* of stacks the route-discovery walks. Mirrors the deploy/diff matcher
|
|
14843
14988
|
* routing rules.
|
|
@@ -15739,7 +15884,7 @@ function warnSsrfRiskyIntegrations(routes, logger) {
|
|
|
15739
15884
|
* server restart in v1.
|
|
15740
15885
|
*/
|
|
15741
15886
|
async function reloadAllServers(args) {
|
|
15742
|
-
const { synthesizeAndBuild, servers, buildPool,
|
|
15887
|
+
const { synthesizeAndBuild, servers, buildPool, logger } = args;
|
|
15743
15888
|
let material;
|
|
15744
15889
|
try {
|
|
15745
15890
|
material = await synthesizeAndBuild();
|
|
@@ -15770,8 +15915,6 @@ async function reloadAllServers(args) {
|
|
|
15770
15915
|
logger.debug(`Previous pool dispose() failed for ${group.displayName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
15771
15916
|
});
|
|
15772
15917
|
}
|
|
15773
|
-
lastAssetPaths.value = computeAssetPaths(material.specs);
|
|
15774
|
-
if (watcher) watcher.update([output, ...lastAssetPaths.value]);
|
|
15775
15918
|
printPerServerRouteTables(servers);
|
|
15776
15919
|
const allRoutes = servers.flatMap((s) => s.group.routes.map((r) => r.route));
|
|
15777
15920
|
warnUnsupportedRoutes(allRoutes, logger);
|
|
@@ -15955,7 +16098,7 @@ function resolveMtlsConfig(options) {
|
|
|
15955
16098
|
*/
|
|
15956
16099
|
function createLocalStartApiCommand(opts = {}) {
|
|
15957
16100
|
setEmbedConfig(opts.embedConfig);
|
|
15958
|
-
const startApi = new Command("start-api").description("Run a long-running local HTTP server that maps API Gateway routes (REST v1, HTTP API, Function URL) to Lambda invocations against the AWS Lambda Runtime Interface Emulator (Docker required). Supports Lambda TOKEN/REQUEST authorizers, Cognito User Pool / HTTP v2 JWT authorizers, and AWS_IAM auth (REST v1 `AuthorizationType: AWS_IAM` and Function URL `AuthType: AWS_IAM` — SigV4 signature verification only; IAM policy evaluation is NOT emulated). When JWKS is unreachable, JWT authorizers fall back to pass-through (every token accepted) with a warn line — local dev fallback. VPC-config Lambdas run locally and surface a warn line at startup; their containers do NOT get attached to the deployed VPC subnets, so calls to private RDS / ElastiCache will fail.").argument("[target]", `Optional API filter. Accepts the bare CDK logical id ('MyHttpApi'; single-stack apps only), stack-qualified logical id ('MyStack:MyHttpApi'), full CDK Construct path ('MyStack/MyHttpApi/Resource'), or an ancestor Construct path that prefix-matches ('MyStack/MyHttpApi'). When omitted, every discovered API gets its own server. Mirrors \`${getEmbedConfig().cliName} invoke\` / \`${getEmbedConfig().cliName} run-task\` target syntax.`).addOption(new Option("--port <port>", "HTTP server port (default: auto-allocate)").default("0")).addOption(new Option("--host <host>", "Bind address").default("127.0.0.1")).addOption(new Option("--stack <name>", "Stack to start (single-stack apps auto-detect)")).addOption(new Option("--all-stacks", "Serve every stack's API in a multi-stack app (each API on its own port) instead of erroring out. Mutually exclusive with a positional target, --stack, and an explicit --from-cfn-stack <name>; the bare --from-cfn-stack flag stays compatible (binds each routed stack to its own CFn stack).").default(false)).addOption(new Option("--warm", "Pre-start one container per Lambda at server boot").default(false)).addOption(new Option("--per-lambda-concurrency <n>", "Pool size cap per Lambda (default 2, max 4)").default("2")).addOption(new Option("--no-pull", "Skip docker pull (cached image)")).addOption(new Option("--container-host <host>", "IP the host uses to bind/probe the RIE port (must be a numeric IP — `docker run -p <ip>:<port>:8080` rejects hostnames). Defaults to 127.0.0.1.").default("127.0.0.1")).addOption(new Option("--debug-port-base <port>", "Reserve a contiguous --debug-port range (one per Lambda)")).addOption(new Option("--env-vars <file>", "JSON env-var overrides (SAM-compatible: {\"LogicalId\":{\"KEY\":\"VALUE\"}, \"Parameters\": {...}})")).addOption(new Option("--assume-role <arn-or-pair>", "Assume the Lambda's execution role and forward STS-issued temp creds. Bare <arn> = global default; <LogicalId>=<arn> = per-Lambda override (repeatable). Per-Lambda > global > unset (developer creds passed through).").argParser((raw, prev) => parseAssumeRoleToken(raw, prev))).addOption(new Option("--watch", "Hot-reload: re-synth + re-discover routes when cdk.
|
|
16101
|
+
const startApi = new Command("start-api").description("Run a long-running local HTTP server that maps API Gateway routes (REST v1, HTTP API, Function URL) to Lambda invocations against the AWS Lambda Runtime Interface Emulator (Docker required). Supports Lambda TOKEN/REQUEST authorizers, Cognito User Pool / HTTP v2 JWT authorizers, and AWS_IAM auth (REST v1 `AuthorizationType: AWS_IAM` and Function URL `AuthType: AWS_IAM` — SigV4 signature verification only; IAM policy evaluation is NOT emulated). When JWKS is unreachable, JWT authorizers fall back to pass-through (every token accepted) with a warn line — local dev fallback. VPC-config Lambdas run locally and surface a warn line at startup; their containers do NOT get attached to the deployed VPC subnets, so calls to private RDS / ElastiCache will fail.").argument("[target]", `Optional API filter. Accepts the bare CDK logical id ('MyHttpApi'; single-stack apps only), stack-qualified logical id ('MyStack:MyHttpApi'), full CDK Construct path ('MyStack/MyHttpApi/Resource'), or an ancestor Construct path that prefix-matches ('MyStack/MyHttpApi'). When omitted, every discovered API gets its own server. Mirrors \`${getEmbedConfig().cliName} invoke\` / \`${getEmbedConfig().cliName} run-task\` target syntax.`).addOption(new Option("--port <port>", "HTTP server port (default: auto-allocate)").default("0")).addOption(new Option("--host <host>", "Bind address").default("127.0.0.1")).addOption(new Option("--stack <name>", "Stack to start (single-stack apps auto-detect)")).addOption(new Option("--all-stacks", "Serve every stack's API in a multi-stack app (each API on its own port) instead of erroring out. Mutually exclusive with a positional target, --stack, and an explicit --from-cfn-stack <name>; the bare --from-cfn-stack flag stays compatible (binds each routed stack to its own CFn stack).").default(false)).addOption(new Option("--warm", "Pre-start one container per Lambda at server boot").default(false)).addOption(new Option("--per-lambda-concurrency <n>", "Pool size cap per Lambda (default 2, max 4)").default("2")).addOption(new Option("--no-pull", "Skip docker pull (cached image)")).addOption(new Option("--container-host <host>", "IP the host uses to bind/probe the RIE port (must be a numeric IP — `docker run -p <ip>:<port>:8080` rejects hostnames). Defaults to 127.0.0.1.").default("127.0.0.1")).addOption(new Option("--debug-port-base <port>", "Reserve a contiguous --debug-port range (one per Lambda)")).addOption(new Option("--env-vars <file>", "JSON env-var overrides (SAM-compatible: {\"LogicalId\":{\"KEY\":\"VALUE\"}, \"Parameters\": {...}})")).addOption(new Option("--assume-role <arn-or-pair>", "Assume the Lambda's execution role and forward STS-issued temp creds. Bare <arn> = global default; <LogicalId>=<arn> = per-Lambda override (repeatable). Per-Lambda > global > unset (developer creds passed through).").argParser((raw, prev) => parseAssumeRoleToken(raw, prev))).addOption(new Option("--watch", "Hot-reload: re-synth + re-discover routes when the CDK app's source changes (honors cdk.json watch.include/exclude; cdk.out, node_modules, .git are always excluded). Off by default; the server keeps the previous version serving when synth fails mid-reload.").default(false)).addOption(new Option("--stage <name>", "Select an API Gateway Stage by its 'StageName'. Default: the first Stage attached to each API. Drives event.stageVariables for both REST v1 and HTTP API v2. NOTE: For HTTP API v2 routes, requestContext.stage is always '$default' regardless of this flag (AWS-side limitation — HTTP API only exposes one stage to the integration event); only event.stageVariables is affected for v2 routes. For REST v1 routes the selected StageName is also threaded into requestContext.stage.")).addOption(new Option("--api <id>", "DEPRECATED — use the positional <target> argument instead. Same accepted forms (bare logical id, stack-qualified, Construct path, ancestor prefix). Will be removed in a future major release.")).addOption(new Option("--layer-role-arn <arn>", "Role to sts:AssumeRole before calling lambda:GetLayerVersion on every literal-ARN entry in Properties.Layers (issue #448). Use only when the dev credentials cannot read the layer — typically cross-account layers. AWS-published public layers (e.g. Lambda Powertools) are readable from every account and need no role.")).addOption(new Option("--from-cfn-stack [cfn-stack-name]", "Read a deployed CloudFormation stack via ListStackResources and substitute Ref / Fn::ImportValue in Lambda env vars with the deployed physical IDs / exports. Use for CDK apps deployed via the upstream CDK CLI (`cdk deploy`). Bare form uses the resolved stack name per routed stack; pass an explicit value when a single CFn stack should serve every routed stack. Fn::GetAtt is warn-and-dropped in v1 (CFn ListStackResources does not return per-attribute values).")).addOption(new Option("--stack-region <region>", "Region of the state record to read. Used with --from-cfn-stack as the CFn client region.")).addOption(new Option("--mtls-truststore <path>", `PEM-encoded CA bundle for client-certificate verification (mutual TLS). When set, the local server switches from HTTP to HTTPS and the TLS handshake rejects clients whose certificate doesn't chain to one of these CAs. Verified certs are surfaced on the Lambda event under requestContext.identity.clientCert (REST v1) / requestContext.authentication.clientCert (HTTP API v2). Must be set together with --mtls-cert + --mtls-key; partial flag sets are rejected. Generate a CA + server + client cert for local dev: openssl req -x509 -newkey rsa:2048 -nodes -keyout ca-key.pem -out ca.pem -subj "/CN=${getEmbedConfig().resourceNamePrefix}-ca" -days 365; openssl req -newkey rsa:2048 -nodes -keyout server-key.pem -out server-csr.pem -subj "/CN=localhost"; openssl x509 -req -in server-csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -days 365; openssl req -newkey rsa:2048 -nodes -keyout client-key.pem -out client-csr.pem -subj "/CN=client"; openssl x509 -req -in client-csr.pem -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out client-cert.pem -days 365; curl --cacert ca.pem --cert client-cert.pem --key client-key.pem https://localhost:<port>/...`)).addOption(new Option("--mtls-cert <path>", "PEM-encoded server certificate for mutual TLS. Self-signed is fine for local dev. Must be set together with --mtls-truststore + --mtls-key.")).addOption(new Option("--mtls-key <path>", "PEM-encoded server private key matching --mtls-cert. Must be set together with --mtls-truststore + --mtls-cert.")).addOption(new Option("--strict-sigv4", "Opt-in: DENY AWS_IAM SigV4 requests that cannot be cryptographically verified (foreign access-key-id — e.g. a federated / Cognito Identity Pool / cross-account signer — OR no local AWS credentials configured) instead of the default warn-and-pass. DEFAULT off: cdk-local warn-and-passes unverifiable IAM requests with a placeholder principalId so local dev exercises app logic without reproducing an auth boundary it cannot fully emulate. OAC-fronted Function URLs always warn-and-pass regardless.").default(false)).action(withErrorHandling(async (target, options) => {
|
|
15959
16102
|
await localStartApiCommand(target, options, opts.extraStateProviders);
|
|
15960
16103
|
}));
|
|
15961
16104
|
[
|
|
@@ -16659,7 +16802,8 @@ async function prepareOneImage(task, container, options) {
|
|
|
16659
16802
|
case "ecr": return pullEcrImage(image.uri, {
|
|
16660
16803
|
skipPull: options.skipPull,
|
|
16661
16804
|
...options.region !== void 0 && { region: options.region },
|
|
16662
|
-
...options.ecrRoleArn !== void 0 && { ecrRoleArn: options.ecrRoleArn }
|
|
16805
|
+
...options.ecrRoleArn !== void 0 && { ecrRoleArn: options.ecrRoleArn },
|
|
16806
|
+
...options.profile !== void 0 && { profile: options.profile }
|
|
16663
16807
|
});
|
|
16664
16808
|
case "cdk-asset": {
|
|
16665
16809
|
const cdkOutDir = task.stack.assetManifestPath ? dirname(task.stack.assetManifestPath) : void 0;
|
|
@@ -16952,6 +17096,7 @@ async function localRunTaskCommand(target, options, extraStateProviders) {
|
|
|
16952
17096
|
if (options.platform) runOpts.platformOverride = options.platform;
|
|
16953
17097
|
if (options.region) runOpts.region = options.region;
|
|
16954
17098
|
if (options.ecrRoleArn) runOpts.ecrRoleArn = options.ecrRoleArn;
|
|
17099
|
+
if (options.profile) runOpts.profile = options.profile;
|
|
16955
17100
|
if (profileCredsFile) runOpts.profileCredentialsFile = {
|
|
16956
17101
|
hostPath: profileCredsFile.hostPath,
|
|
16957
17102
|
containerPath: profileCredsFile.containerPath,
|
|
@@ -17028,7 +17173,7 @@ async function buildEcsImageResolutionContext$1(candidate, stateProvider, option
|
|
|
17028
17173
|
if (!region) logger.warn(`Resolver references \${AWS::Region} but ${getEmbedConfig().binaryName} could not determine the target region. Pass --region, set AWS_REGION, or declare env.region on the CDK stack.`);
|
|
17029
17174
|
let accountId;
|
|
17030
17175
|
try {
|
|
17031
|
-
accountId = await resolveCallerAccountId$1(region);
|
|
17176
|
+
accountId = await resolveCallerAccountId$1(region, options.profile);
|
|
17032
17177
|
} catch (err) {
|
|
17033
17178
|
logger.warn(`Resolver needs \${AWS::AccountId} but STS GetCallerIdentity failed: ${err instanceof Error ? err.message : String(err)}. Substitution will be skipped; affected env / secret entries will be dropped with per-key warnings.`);
|
|
17034
17179
|
}
|
|
@@ -17058,9 +17203,12 @@ function pickCandidateStack$1(stackPattern, stacks) {
|
|
|
17058
17203
|
const matched = matchStacks(stacks, [stackPattern]);
|
|
17059
17204
|
if (matched.length === 1) return matched[0];
|
|
17060
17205
|
}
|
|
17061
|
-
async function resolveCallerAccountId$1(region) {
|
|
17206
|
+
async function resolveCallerAccountId$1(region, profile) {
|
|
17062
17207
|
const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
|
|
17063
|
-
const sts = new STSClient({
|
|
17208
|
+
const sts = new STSClient({
|
|
17209
|
+
...region && { region },
|
|
17210
|
+
...profile && { profile }
|
|
17211
|
+
});
|
|
17064
17212
|
try {
|
|
17065
17213
|
return (await sts.send(new GetCallerIdentityCommand({}))).Account;
|
|
17066
17214
|
} finally {
|
|
@@ -18361,6 +18509,7 @@ async function runOneTarget(target, runState, stacks, options, discovery, skipPu
|
|
|
18361
18509
|
if (options.platform) taskOpts.platformOverride = options.platform;
|
|
18362
18510
|
if (options.region) taskOpts.region = options.region;
|
|
18363
18511
|
if (options.ecrRoleArn) taskOpts.ecrRoleArn = options.ecrRoleArn;
|
|
18512
|
+
if (options.profile) taskOpts.profile = options.profile;
|
|
18364
18513
|
if (profileCredsFile && !assumedCredentials) taskOpts.profileCredentialsFile = {
|
|
18365
18514
|
hostPath: profileCredsFile.hostPath,
|
|
18366
18515
|
containerPath: profileCredsFile.containerPath,
|
|
@@ -18420,7 +18569,7 @@ async function buildEcsImageResolutionContext(target, stacks, options, stateProv
|
|
|
18420
18569
|
if (!region) logger.warn(`Resolver references \${AWS::Region} but ${getEmbedConfig().binaryName} could not determine the target region. Pass --region, set AWS_REGION, or declare env.region on the CDK stack.`);
|
|
18421
18570
|
let accountId;
|
|
18422
18571
|
try {
|
|
18423
|
-
accountId = await resolveCallerAccountId(region);
|
|
18572
|
+
accountId = await resolveCallerAccountId(region, options.profile);
|
|
18424
18573
|
} catch (err) {
|
|
18425
18574
|
logger.warn(`Resolver needs \${AWS::AccountId} but STS GetCallerIdentity failed: ${err instanceof Error ? err.message : String(err)}. Substitution will be skipped; affected env / secret entries will be dropped with per-key warnings.`);
|
|
18426
18575
|
}
|
|
@@ -18450,9 +18599,12 @@ function pickCandidateStack(stackPattern, stacks) {
|
|
|
18450
18599
|
const matched = matchStacks(stacks, [stackPattern]);
|
|
18451
18600
|
if (matched.length === 1) return matched[0];
|
|
18452
18601
|
}
|
|
18453
|
-
async function resolveCallerAccountId(region) {
|
|
18602
|
+
async function resolveCallerAccountId(region, profile) {
|
|
18454
18603
|
const { STSClient, GetCallerIdentityCommand } = await import("@aws-sdk/client-sts");
|
|
18455
|
-
const sts = new STSClient({
|
|
18604
|
+
const sts = new STSClient({
|
|
18605
|
+
...region && { region },
|
|
18606
|
+
...profile && { profile }
|
|
18607
|
+
});
|
|
18456
18608
|
try {
|
|
18457
18609
|
return (await sts.send(new GetCallerIdentityCommand({}))).Account;
|
|
18458
18610
|
} finally {
|
|
@@ -18539,4 +18691,4 @@ function createLocalStartServiceCommand(opts = {}) {
|
|
|
18539
18691
|
|
|
18540
18692
|
//#endregion
|
|
18541
18693
|
export { LocalStateSourceError as A, discoverWebSocketApis as C, pickRefLogicalId as D, discoverRoutes as E, resolveCfnRegion as F, resolveCfnStackName as I, CfnLocalStateProvider as L, isCfnFlagPresent as M, rejectExplicitCfnStackWithMultipleStacks as N, resolveLambdaArnIntrinsic as O, resolveCfnFallbackRegion as P, buildRestV1Event as S, parseSelectionExpressionPath as T, invokeTokenAuthorizer as _, createAuthorizerCache as a, applyAuthorizerOverlay as b, buildCognitoJwksUrl as c, verifyCognitoJwt as d, verifyJwtAuthorizer as f, invokeRequestAuthorizer as g, evaluateCachedLambdaPolicy as h, createLocalStartApiCommand as i, createLocalStateProvider as j, createLocalInvokeCommand as k, buildJwksUrlFromIssuer as l, computeRequestIdentityHash as m, getContainerNetworkIp as n, resolveSelectionExpression as o, buildMethodArn as p, createLocalRunTaskCommand as r, resolveServiceIntegrationParameters as s, createLocalStartServiceCommand as t, createJwksCache as u, matchRoute as v, discoverWebSocketApisOrThrow as w, buildHttpApiV2Event as x, translateLambdaResponse as y };
|
|
18542
|
-
//# sourceMappingURL=local-start-service-
|
|
18694
|
+
//# sourceMappingURL=local-start-service-C1AHpRo-.js.map
|