-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[@aws-cdk/aws-events] Schedule cannot be created from CfnParameter #9413
Comments
As a workaround, use For fixing this:
Same for other |
For the records, here is a working example for the proposed workaround: const rateMinutes = new cdk.CfnParameter(this, "RateMinutes", {
default: 5,
description: "...",
type: "Number",
});
new events.Rule(this, "ScheduledFlush", {
schedule: events.Schedule.expression(`rate(${rateMinutes.value} minutes)`),
targets: [
new eventsTargets.LambdaFunction(flushFunction),
],
});
|
Thanks for the workaround suggestions. |
Fix for Issue: #9413 Testing: Unit tests added for Schedule.rate used in ApplicationAutoScaling and Events. * [X] Testing - Unit test added (prefer not to modify an existing test, otherwise, it's probably a breaking change) - __CLI change?:__ coordinate update of integration tests with team - __cdk-init template change?:__ coordinated update of integration tests with team * [X] Docs - __jsdocs__: All public APIs documented - __README__: README and/or documentation topic updated - __Design__: For significant features, design document added to `design` folder * [X] Title and Description - __Change type__: title prefixed with **fix**, **feat** and module name in parents, which will appear in changelog - __Title__: use lower-case and doesn't end with a period - __Breaking?__: last paragraph: "BREAKING CHANGE: <describe what changed + link for details>" - __Issues__: Indicate issues fixed via: "**Fixes #xxx**" or "**Closes #xxx**" * [ ] Sensitive Modules (requires 2 PR approvers) - IAM Policy Document (in @aws-cdk/aws-iam) - EC2 Security Groups and ACLs (in @aws-cdk/aws-ec2) - Grant APIs (only if not based on official documentation with a reference) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
The code in this issue can be used without error in the meanwhile. @peterwoodworth Could you please close this issue? |
Will do, thank you |
|
When trying to use a parameter for the duration of a events Schedule, on synth, an error occurs:
"Unable to perform time unit conversion on un-resolved token -1.8881545897087682e+289."
Specifying the duration for e.g. a Lambda timeout works, but not if the Duration is used in a
Schedule.rate
.Reproduction Steps
Error Log
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: