I'm trying to use the "Discord Webhook" built-in b...
# ask-community
m
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
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
I see. But I'm not sure I understand how I would resolve it, then?
c
The short version is you can't register custom blocks for any server-side functionality with Prefect Cloud
j
Does this mean then that I cannot create automations with Prefect Cloud that can send a notification to a discord webhook?
c
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)
j
Aah I see. Thanks for the quick answers 🙂
🫡 1