Invoke durable functions via CronJob #499
|
I'd like to invoke a durable function via an EventBridge Rule, but this doesn't seem to work. My guess it's due to the need to invoke it asynchronously. My CDK code is like this: new Rule(scope, "AndChargeStationImageImportTrigger", {
ruleName: "AndChargeStationImageImportTrigger",
enabled: isProduction(andChargeStationImageImportLambda),
schedule: Schedule.expression("cron(49 2 * * ? *)"),
targets: [new LambdaFunction(andChargeStationImageImportLambda)],
});How can I invoke a durable function in a cron job? |
Replies: 2 comments
|
Hello aaarichter, Lambda invocations made through EventbridgeRule are by default asynchronously invoked. I believe the reason why your CDK code is not working is because for durable lambda functions, you need to use a qualified ARN. I.E. you need to specify a version of the function. Please reference a particular version of the function instead. https://docs.aws.amazon.com/lambda/latest/dg/durable-invoking.html#durable-invoking-qualified-arns Please note that for "Production" use cases, we don't recommend using $LATEST. |
|
@aaarichter +1 on @SilanHe's comment. Couple additional notes:
|
Hello aaarichter,
, thanks for your patience. Our team is still figuring out team mechanisms for working with Github. We appreciate your understanding.
Lambda invocations made through EventbridgeRule are by default asynchronously invoked. I believe the reason why your CDK code is not working is because for durable lambda functions, you need to use a qualified ARN. I.E. you need to specify a version of the function. Please reference a particular version of the function instead.
https://docs.aws.amazon.com/lambda/latest/dg/durable-invoking.html#durable-invoking-qualified-arns
Please note that for "Production" use cases, we don't recommend using $LATEST.