Skip to content

Unable to use CfnParameter valueAsNumber in SQS Queue #7126

@amwill04

Description

@amwill04

If trying to use a CfnParameter with a SQS Queue you end up with the following error:

message retention period must be 60 seconds or more, but -1.8881545897087585e+289 was provided

Reproduction Steps

        const redemptionPeriod = new CfnParameter(this, 'RedendtionPeriod', {
            description: 'SQS redention period in seconds 60 - 1209600 [14400]',
            type: 'Number',
            default: 14400,
            minValue: 60,
            maxValue: 1209600,
            constraintDescription: 'Must be between 60 and 1209600',
        });

        return new Queue(this, 'Queue', {
            queueName: 'queue',
            retentionPeriod: Duration.seconds(redemptionPeriod.valueAsNumber), // This pass typechecking but will at best fail and at worst pass with the incorrect number.
            deliveryDelay: Duration.seconds(0),
            maxMessageSizeBytes: 1024,
            receiveMessageWaitTime: Duration.seconds(20),
            visibilityTimeout: Duration.seconds(60),
        });

Error Log

message retention period must be 60 seconds or more, but -1.8881545897087585e+289 was provided

Environment

  • **CLI Version :1.31.0
  • **Framework Version:1.31.0
  • **OS :MacOS
  • **Language :Typescript

This is 🐛 Bug Report

Metadata

Metadata

Labels

@aws-cdk/coreRelated to core CDK functionalitybugThis issue is a bug.in-progressThis issue is being actively worked on.p1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions