<@ULVA73B9P> When a notification is triggered from...
# ask-marvin
b
@Marvin When a notification is triggered from my automation, I get this error message. What can it be?
Copy code
"event": "prefect-cloud.automation.action.failed",
  "occurred": "2024-05-13T12:58:59.148Z",
  "payload": {
    "action_index": 0,
    "action_type": "send-notification",
    "invocation": "2069621f-437f-46d3-b449-3fff4b0299e3",
    "reason": "The notification block was invalid: KeyError(\"No class found for dispatch key 'slack-incoming-webhook' in registry for type 'Block'.\")"
  },
m
It appears there's a problem with the configuration of the notification block for Slack. The error indicates that Prefect is expecting to find a registered block type that matches the dispatch key 'slack-incoming-webhook', but none was found. This might be because you haven't registered the correct block for Slack notifications. You may need to register a block of type 'SlackWebhook' to use in your automation. Here's a relevant excerpt from the Prefect documentation which provides some guidance on registering and using Slack blocks:
"...first install the required packages, then... note, to use the
prefect block register -m prefect_slack
load method on Blocks, you must already have a block document saved through code or saved through the UI... To load the SlackWebhook...
from prefect import flow
from prefect_slack.credentials import SlackWebhook
@flow
def my_flow():
my_block = SlackWebhook.load(\"MY_BLOCK_NAME\")
`my_flow()`"
You'll need to ensure that the Slack webhook block is correctly registered within your Prefect environment. For more details on how to register and use blocks in Prefect, you can refer to the full documentation: - Automations in Prefect - Blocks Catalog for Slack in Prefect Additionally, no issues were found from the GitHub Issues search that correspond directly to this error, suggesting this might be a configuration issue rather than a known bug. Please ensure you follow the steps in the Prefect documentation to properly set up your Slack integration and register your webhook block. If you encounter further problems, it may be worth checking for updates or reaching out to the Prefect community for assistance.