AuditEvent Subscriptions not Triggering
# support
k
Hi, I've created a subscription where the criteria is
AuditEvent?outcome:not=0&type=execute
. Then, to test it, I trigger a bot I know is going to fail. I see the AuditEvent being created, but the subscription is not being triggered. I changed the criteria to
Patient
and edited a patient and the subscription was triggered. Are we able to have a subscription on
AuditEvent
?
r
Hi @kc_bub , I gave you some bad advice earlier 😔 Turns out we restrict subscriptions on AuditEvents (https://github.com/medplum/medplum/blob/f807a639c4a8a02ef48615b0a355ec70c2f9927d/packages/server/src/workers/subscription.ts#L138-L141)
The reason is to avoid a notification spiral as follows:
AuditEvent -> Trigger Subscription -> Create AuditEvent ->  Trigger Subscription -> ...
k
Ahh yes, okay. That makes sense. Do you have any thoughts on any other interim solution to monitoring bot failures until we're able to stream bot metrics?
r
Yes, but unfortunately it's a bit manual. For the time being, you could notify from within the bot. 1. Wrap the whole bot in a
try/catch
2. If you catch an error, use
fetch
to call your notification endpoint. Use Project secrets to store the credentials of the endpoint
k
Thank you! I'll take it back to the team
150 Views