Fork me on GitHub
#datomic
<
2021-11-29
>
Benjamin08:11:19

What is the correct way to schedule a lambda ion say every 30min? I tried to click it in "EventBridge" but it errs:

datomic.ion.lambda.handler.exceptions.Incorrect: datomic.ion.lambda.handler.exceptions.Incorrect
--- Is there a command to remove ions? --- where can I read on logging from inside an ion?

Benjamin14:11:43

datomic.ion.lambda.handler.exceptions.Incorrect: datomic.ion.lambda.handler.exceptions.Incorrect
clojure.lang.ExceptionInfo: null {:cognitect.anomalies/category :cognitect.anomalies/incorrect, :cognitect.anomalies/message nil}
	at datomic.ion.lambda.handler$throw_anomaly.invokeStatic(handler.clj:25)
	at datomic.ion.lambda.handler$throw_anomaly.invoke(handler.clj:21)
	at datomic.ion.lambda.handler.Handler.on_anomaly(handler.clj:175)
	at datomic.ion.lambda.handler.Handler.handle_request(handler.clj:205)
	at datomic.ion.lambda.handler$fn__3856$G__3781__3861.invoke(handler.clj:68)
	at datomic.ion.lambda.handler$fn__3856$G__3780__3867.invoke(handler.clj:68)
	at clojure.lang.Var.invoke(Var.java:399)
	at datomic.ion.lambda.handler.Thunk.handleRequest(Thunk.java:35)

Daniel Jomphe14:11:11

If you remove references to an ion from ion-config.edn, the next deployment will delete the orphaned lambda(s). As for you original question, I let other people answer it.

Benjamin14:11:26

I see thanks

Joe Lane16:11:49

You can invoke a Lambda however you'd like. Event-Bridge (formerly CloudWatch Events) is a fine option for a scheduled "cron" task.

Joe Lane16:11:01

@U02CV2P4J6S If you're still having trouble with this, you can follow the https://github.com/Datomic/ion-starter project, specifically, the section on https://github.com/Datomic/ion-starter/blob/master/src/datomic/ion/starter/lambdas.clj for inspiration.

Benjamin16:11:08

@U0CJ19XAM hm. Do you know if the event bridge has the correct permissions and such by default? I guess I'll try making a simple one work

Joe Lane16:11:39

Datomic doesn't give any AWS services permissions to invoke Lambda Ions by default.

Benjamin16:11:06

Ah alright. Then I know I have to grant the permission/role somehow

Joe Lane16:11:22

I'd follow https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-run-lambda-schedule.html but use the Lambda Ion instead of the javascript one they show you how to make. Specifically, you need to do the part (that I can't link to facepalm ) that starts with the phrase To grant the EventBridge service principal....

👀 1
Benjamin16:11:13

thanks a lot that was the thing

💯 1