Can't use notification with slackbot due to ssl error

I’m using AWX version 23.6.0, awx operator 2.10.0.
I already followed the guide how to integrate slackbot to awx 23. Notifications — Ansible Tower User Guide v3.8.6.
But when I run test slack notification, I always get this error

    return backend_obj.send_messages([notification_obj])
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/awx/main/notifications/slack_backend.py", line 48, in send_messages
    response = client.chat_postMessage(channel=channel, thread_ts=thread, as_user=True, text=m.subject)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/slack_sdk/web/client.py", line 2072, in chat_postMessage
    return self.api_call("chat.postMessage", json=kwargs)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/slack_sdk/web/base_client.py", line 156, in api_call
    return self._sync_send(api_url=api_url, req_args=req_args)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/slack_sdk/web/base_client.py", line 187, in _sync_send
    return self._urllib_api_call(
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/slack_sdk/web/base_client.py", line 294, in _urllib_api_call
    response = self._perform_urllib_http_request(url=url, args=request_args)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/slack_sdk/web/base_client.py", line 473, in _perform_urllib_http_request
    raise err
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/slack_sdk/web/base_client.py", line 397, in _perform_urllib_http_request
    resp = self._perform_urllib_http_request_internal(url, req)
  File "/var/lib/awx/venv/awx/lib64/python3.9/site-packages/slack_sdk/web/base_client.py", line 502, in _perform_urllib_http_request_internal
    resp = opener.open(req, timeout=self.timeout)  # skipcq: BAN-B310
  File "/usr/lib64/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/usr/lib64/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/usr/lib64/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib64/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/usr/lib64/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)>

Do I need to configure anything else?
I already set validate_certs: false but issue still there.

Hi, is your AWX behind proxy?
If so, adding custom CA cert to AWX instance may help you: Trusting a custom certificate authority - Ansible AWX Operator Documentation

I found out a way to fix it. Actually, I use mitmproxy, so I added www.slack.com in NO_PROXY the problem gone away.

I had to build awx in my local (without proxy, https), itdisplay different message. So I awared that slack uses https://www.slack.com/api/chat.postMessage.

│ 2024-01-26 16:46:41,474 ERROR [a4222c82c38d49e79eea6d28fbd7146a] awx.main.tasks.system Send Notification Failed The request to the Slack API failed. (url: https://www.slack.com/api/chat.postMessage)

1 Like