Skip to content

retentionInDays for logs.LogGroup using a CfnParameter throws an error #6690

@nmoutschen

Description

@nmoutschen

When using the retention property in logs.LogGroup and provide the value of a parameter, it throws an error that the number is negative: retentionInDays must be positive, got -1.888154589708755e+289. This exception seems to be thrown by the LogGroup.

Here is the CfnParameter:

const retentionInDays = new cdk.CfnParameter(this, "RetentionInDays", { default: 30, type: "Number" });

The log group:

new logs.LogGroup(this, "PreAuthLogGroup", {
  logGroupName: "/aws/lambda/"+preAuthFunction.functionName,
  retention: retentionInDays.valueAsNumber
});

Reproduction Steps

  1. Create a stack with the two resources mentioned above.
  2. Run cdk synth.

Error Log

retentionInDays must be positive, got -1.888154589708755e+289

Environment

  • CLI Version : 1.27.0
  • Framework Version: 1.27.0
  • OS : MacOS
  • Language : Typescript

Other


This is 🐛 Bug Report

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-logsRelated to Amazon CloudWatch LogsbugThis issue is a bug.good first issueRelated to contributions. See CONTRIBUTING.mdin-progressThis issue is being actively worked on.p2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions