@jaypie/constructs 1.1.32 → 1.1.34
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/cjs/index.cjs +37 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +37 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -292,6 +292,29 @@ class JaypieLambda extends Construct {
|
|
|
292
292
|
const { code, datadogApiKeyArn, environment: initialEnvironment = {}, envSecrets = {}, handler = "index.handler", layers = [], logRetention = CDK$2.LAMBDA.LOG_RETENTION, memorySize = CDK$2.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, provisionedConcurrentExecutions, reservedConcurrentExecutions, roleTag = CDK$2.ROLE.PROCESSING, runtime = lambda.Runtime.NODEJS_22_X, secrets = [], timeout = Duration.seconds(CDK$2.DURATION.LAMBDA_WORKER), vendorTag, } = props;
|
|
293
293
|
// Create a mutable copy of the environment variables
|
|
294
294
|
let environment = { ...initialEnvironment };
|
|
295
|
+
// Default environment values
|
|
296
|
+
const defaultEnvValues = {
|
|
297
|
+
AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING: "true",
|
|
298
|
+
};
|
|
299
|
+
// Apply default environment values with user overrides
|
|
300
|
+
Object.entries(defaultEnvValues).forEach(([key, defaultValue]) => {
|
|
301
|
+
if (key in initialEnvironment) {
|
|
302
|
+
const userValue = initialEnvironment[key];
|
|
303
|
+
// If user passes a string, use that value
|
|
304
|
+
if (typeof userValue === "string") {
|
|
305
|
+
environment[key] = userValue;
|
|
306
|
+
}
|
|
307
|
+
// If user passes non-string falsy value, omit the key
|
|
308
|
+
else if (!userValue) {
|
|
309
|
+
delete environment[key];
|
|
310
|
+
}
|
|
311
|
+
// Ignore non-string truthy values (key already not present)
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
// No user override, use default value
|
|
315
|
+
environment[key] = defaultValue;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
295
318
|
// Default environment variables from process.env if present
|
|
296
319
|
const defaultEnvVars = [
|
|
297
320
|
"DATADOG_API_KEY_ARN",
|
|
@@ -390,6 +413,14 @@ class JaypieLambda extends Construct {
|
|
|
390
413
|
reservedConcurrentExecutions,
|
|
391
414
|
runtime,
|
|
392
415
|
timeout: typeof timeout === "number" ? Duration.seconds(timeout) : timeout,
|
|
416
|
+
// Enable auto-publishing of versions when using provisioned concurrency
|
|
417
|
+
currentVersionOptions: provisionedConcurrentExecutions !== undefined
|
|
418
|
+
? {
|
|
419
|
+
removalPolicy: RemovalPolicy.RETAIN,
|
|
420
|
+
description: "Auto-published version for provisioned concurrency",
|
|
421
|
+
// Don't set provisioned concurrency here - it will be set on the alias
|
|
422
|
+
}
|
|
423
|
+
: undefined,
|
|
393
424
|
});
|
|
394
425
|
// Grant secret read permissions
|
|
395
426
|
Object.values(envSecrets).forEach((secret) => {
|
|
@@ -407,11 +438,16 @@ class JaypieLambda extends Construct {
|
|
|
407
438
|
}
|
|
408
439
|
// Configure provisioned concurrency if specified
|
|
409
440
|
if (provisionedConcurrentExecutions !== undefined) {
|
|
441
|
+
// Use currentVersion which is auto-published with proper configuration
|
|
442
|
+
const version = this._lambda.currentVersion;
|
|
443
|
+
// Create alias for provisioned concurrency
|
|
410
444
|
this._alias = new lambda.Alias(this, "ProvisionedAlias", {
|
|
411
445
|
aliasName: "provisioned",
|
|
412
|
-
version
|
|
446
|
+
version,
|
|
413
447
|
provisionedConcurrentExecutions,
|
|
414
448
|
});
|
|
449
|
+
// Add explicit dependencies to ensure proper creation order
|
|
450
|
+
this._alias.node.addDependency(version);
|
|
415
451
|
}
|
|
416
452
|
if (roleTag) {
|
|
417
453
|
Tags.of(this._lambda).add(CDK$2.TAG.ROLE, roleTag);
|