-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/coreRelated to core CDK functionalityRelated to core CDK functionalitybugThis issue is a bug.This issue is a bug.p2
Description
Describe the bug
The CustomResource construct takes a serviceTimeout prop. The construct has some validation logic for the value if it isn't a token:
| if (props.serviceTimeout !== undefined && !Token.isUnresolved(props.serviceTimeout) |
But I was not able to pass a token for serviceTimeout. I have the following unit test:
test('set serviceTimeout', () => {
// GIVEN
const stack = new Stack();
const durToken = new CfnParameter(stack, 'MyParameter', {
type: 'Number',
default: 60,
});
// WHEN
new CustomResource(stack, 'MyCustomResource', {
serviceToken: 'MyServiceToken',
serviceTimeout: durToken as any,
});
});
It fails with following error:
props.serviceTimeout?.toSeconds is not a function
TypeError: props.serviceTimeout?.toSeconds is not a function
I also tried the following test:
test('set serviceTimeout', () => {
// GIVEN
const stack = new Stack();
const durToken = new CfnParameter(stack, 'MyParameter', {
type: 'Number',
default: 60,
});
// WHEN
new CustomResource(stack, 'MyCustomResource', {
serviceToken: 'MyServiceToken',
serviceTimeout: Duration.seconds(durToken.valueAsNumber),
});
});
It fails with following error:
Error: serviceTimeout must either be between 1 and 3600 seconds, got -1.8881545897087526e+289
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
It should take a token as the value.
Current Behavior
Using token would cause error. See above.
Reproduction Steps
See above
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.179.0
Framework Version
No response
Node.js Version
20
OS
Mac
Language
TypeScript
Language Version
No response
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/coreRelated to core CDK functionalityRelated to core CDK functionalitybugThis issue is a bug.This issue is a bug.p2