I'm trying to use the "Discord Webhook" built-in block as an action to an Automation when a Flow Run enters a Failed or crashed state, but I'm getting the following error message in the Event Feed:
Copy code
{
"id": "<redacted>",
"account": "<redacted>",
"event": "prefect-cloud.automation.action.failed",
"occurred": "2024-08-20T18:13:52.320Z",
"payload": {
"action_index": 0,
"action_type": "send-notification",
"invocation": "<redacted>",
"reason": "The notification block was invalid: KeyError(\"No class found for dispatch key 'discord-webhook' in registry for type 'Block'.\")"
},
"received": "2024-08-20T18:13:52.321Z",
"related": [],
"resource": {
"prefect.resource.id": "prefect-cloud.automation.bda3773c-89f0-4693-b501-c4983b32997b",
"prefect.resource.name": "Notify about failed or crashed runs",
"prefect-cloud.trigger-type": "event",
"prefect-cloud.posture": "Reactive"
},
"workspace": "<redacted>"
}
c
Chris White
08/20/2024, 7:44 PM
Hey Morten - this is an annoying subtly with blocks; when you register a custom block type and schema you are really only registering the configuration schema, not the Python class itself. This means that the functionality implemented on the class isn't available on the Server, which is what
Copy code
No class found for dispatch key 'discord-webhook' in registry for type 'Block'
is saying
m
Morten Hauge
08/20/2024, 7:46 PM
I see. But I'm not sure I understand how I would resolve it, then?
c
Chris White
08/20/2024, 7:47 PM
The short version is you can't register custom blocks for any server-side functionality with Prefect Cloud
j
Jahn Thomas Fidje
08/20/2024, 8:15 PM
Does this mean then that I cannot create automations with Prefect Cloud that can send a notification to a discord webhook?
c
Chris White
08/20/2024, 8:17 PM
Essentially yes, you'd need to have the automation trigger a workflow run in your environment where the discord block is defined; this is a popular use of a managed work pool actually (which still effectively runs server side and doesn't take up any space in your workers' environment)
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.