@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.
@@ -324,6 +324,29 @@ class JaypieLambda extends constructs.Construct {
324
324
  const { code, datadogApiKeyArn, environment: initialEnvironment = {}, envSecrets = {}, handler = "index.handler", layers = [], logRetention = cdk.CDK.LAMBDA.LOG_RETENTION, memorySize = cdk.CDK.LAMBDA.MEMORY_SIZE, paramsAndSecrets, paramsAndSecretsOptions, provisionedConcurrentExecutions, reservedConcurrentExecutions, roleTag = cdk.CDK.ROLE.PROCESSING, runtime = lambda__namespace.Runtime.NODEJS_22_X, secrets = [], timeout = cdk$1.Duration.seconds(cdk.CDK.DURATION.LAMBDA_WORKER), vendorTag, } = props;
325
325
  // Create a mutable copy of the environment variables
326
326
  let environment = { ...initialEnvironment };
327
+ // Default environment values
328
+ const defaultEnvValues = {
329
+ AWS_LAMBDA_NODEJS_DISABLE_CALLBACK_WARNING: "true",
330
+ };
331
+ // Apply default environment values with user overrides
332
+ Object.entries(defaultEnvValues).forEach(([key, defaultValue]) => {
333
+ if (key in initialEnvironment) {
334
+ const userValue = initialEnvironment[key];
335
+ // If user passes a string, use that value
336
+ if (typeof userValue === "string") {
337
+ environment[key] = userValue;
338
+ }
339
+ // If user passes non-string falsy value, omit the key
340
+ else if (!userValue) {
341
+ delete environment[key];
342
+ }
343
+ // Ignore non-string truthy values (key already not present)
344
+ }
345
+ else {
346
+ // No user override, use default value
347
+ environment[key] = defaultValue;
348
+ }
349
+ });
327
350
  // Default environment variables from process.env if present
328
351
  const defaultEnvVars = [
329
352
  "DATADOG_API_KEY_ARN",
@@ -422,6 +445,14 @@ class JaypieLambda extends constructs.Construct {
422
445
  reservedConcurrentExecutions,
423
446
  runtime,
424
447
  timeout: typeof timeout === "number" ? cdk$1.Duration.seconds(timeout) : timeout,
448
+ // Enable auto-publishing of versions when using provisioned concurrency
449
+ currentVersionOptions: provisionedConcurrentExecutions !== undefined
450
+ ? {
451
+ removalPolicy: cdk$1.RemovalPolicy.RETAIN,
452
+ description: "Auto-published version for provisioned concurrency",
453
+ // Don't set provisioned concurrency here - it will be set on the alias
454
+ }
455
+ : undefined,
425
456
  });
426
457
  // Grant secret read permissions
427
458
  Object.values(envSecrets).forEach((secret) => {
@@ -439,11 +470,16 @@ class JaypieLambda extends constructs.Construct {
439
470
  }
440
471
  // Configure provisioned concurrency if specified
441
472
  if (provisionedConcurrentExecutions !== undefined) {
473
+ // Use currentVersion which is auto-published with proper configuration
474
+ const version = this._lambda.currentVersion;
475
+ // Create alias for provisioned concurrency
442
476
  this._alias = new lambda__namespace.Alias(this, "ProvisionedAlias", {
443
477
  aliasName: "provisioned",
444
- version: this._lambda.currentVersion,
478
+ version,
445
479
  provisionedConcurrentExecutions,
446
480
  });
481
+ // Add explicit dependencies to ensure proper creation order
482
+ this._alias.node.addDependency(version);
447
483
  }
448
484
  if (roleTag) {
449
485
  cdk$1.Tags.of(this._lambda).add(cdk.CDK.TAG.ROLE, roleTag);