<@ULVA73B9P> I have a slack incoming webhook block...
# ask-marvin
l
@Marvin I have a slack incoming webhook block. When I use this block to send slack notification from state change hook, its working fine. However if I select this same block in an automation to send slack notification in Action step, automation action fails with the following error message:
Copy code
"reason": "The notification block was invalid: KeyError(\"No class found for dispatch key 'slack-incoming-webhook' in registry for type 'Block'.\")"
Is it a bug or I am missing something here?
m
thought for 142.3 seconds
What you’re seeing is expected behavior, not usually a user mistake. Why it works in a state change hook but fails in an automation - State change hooks run in the environment where your flow code is running. - Automations run in the Prefect server/Cloud automation environment. Your block is the integration-provided Slack block with dispatch key
slack-incoming-webhook
, which comes from the
prefect-slack
package. In the automation runtime, Prefect tries to reconstruct that block type and fails because that class is not available there:
Copy code
"The notification block was invalid: KeyError("No class found for dispatch key 'slack-incoming-webhook' in registry for type 'Block'.")"
So the issue is basically: - local flow environment has
prefect-slack
installed -> hook works - automation runtime does not have that block class registered -> automation fails Recommended fix Use the built-in Prefect notification block instead of the
prefect-slack
integration block for automations: - built-in block slug:
slack-webhook
- integration block slug:
slack-incoming-webhook
The built-in
SlackWebhook
block is supported for notification actions and does not depend on
prefect-slack
being installed in the automation runtime. What to do 1. Create a new block using the built-in Slack webhook notification block 2. Select that new block in your automation action 3. Keep your existing
prefect-slack
block for flow code/hooks only if you want Docs - Automations: sending notifications - State change hooks - Comparison of the two Slack webhook block types - Pre-registered blocks Short version You’re likely not missing anything — you’re using the wrong Slack block type for automations. For automation notification actions, prefer the built-in
slack-webhook
block instead of
slack-incoming-webhook
. If you want, I can also show you exactly how to identify which Slack block you currently saved and how to recreate it correctly in the UI.