alerta / alerta-contrib

Contributed integrations, plugins and custom webhooks
http://alerta.io
MIT License
120 stars 171 forks source link

Error while running plugin 'alerta_slack' #396

Open qx10 opened 1 year ago

qx10 commented 1 year ago

Hello! I have Alerta installation in Kubernetes with alerts from several sources and it works good. But if I try to enable slack plugin I see error in pod logs (see below). Alerta installed by Helm chart with image alerta/alerta-web:9.0.0. Enabled plugins in config: PLUGINS = ['blackout','heartbeat','slack'] Also I use following SLACK params - SLACK_WEBHOOK_URL and SLACK_CHANNEL - to try receive anything from Alerta.

How I can resolve this problem? I need to add additional params or it's probably a bug?

2023-07-07 05:04:49,283 alerta.app[45]: [ERROR] Error while running post-receive plugin 'alerta_slack': 'NoneType' object has no attribute 'repeat' request_id=f233a163f18674f27fe26520a739b6c4 ip=10.244.229.44
Traceback (most recent call last):
  File "/venv/lib/python3.8/site-packages/alerta/utils/api.py", line 74, in process_alert
    updated = plugin.post_receive(alert, config=wanted_config)
  File "/venv/lib/python3.8/site-packages/alerta_slack.py", line 194, in post_receive
    if alert.repeat:
AttributeError: 'NoneType' object has no attribute 'repeat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/venv/lib/python3.8/site-packages/alerta/webhooks/custom.py", line 55, in custom
    alert = process_alert(alert)
  File "/venv/lib/python3.8/site-packages/alerta/utils/api.py", line 81, in process_alert
    raise ApiError(f"Error while running post-receive plugin '{plugin.name}': {str(e)}")
alerta.exceptions.ApiError: Error while running post-receive plugin 'alerta_slack': 'NoneType' object has no attribute 'repeat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/venv/lib/python3.8/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/venv/lib/python3.8/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/venv/lib/python3.8/site-packages/flask_cors/decorator.py", line 128, in wrapped_function
    resp = make_response(f(*args, **kwargs))
  File "/venv/lib/python3.8/site-packages/alerta/auth/decorators.py", line 53, in wrapped
    return f(*args, **kwargs)
  File "/venv/lib/python3.8/site-packages/alerta/webhooks/custom.py", line 73, in custom
    raise ApiError(str(e), 500)
alerta.exceptions.ApiError: Error while running post-receive plugin 'alerta_slack': 'NoneType' object has no attribute 'repeat'