@jaypie/constructs 1.1.33 → 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",