0

Background

One use case I have with MWAA is sending out Slack notifications by the use of Slack Incoming Webhook. To do so, I have installed the Slack Provider package so that I could create a connector and make use of the operator called SlackWebhookOperator.

To validate the connection and test the operator, I’ve created a simple DAG to send out a message to a slack channel:

from airflow import DAG
from airflow.contrib.operators.slack_webhook_operator import SlackWebhookOperator

with DAG(
'slack_operator_validation',
default_args={
'depends_on_past': True,
'email': \['XXX@XXX.com'\],
'email_on_failure': True,
'email_on_retry': False,
'retries': 7,
'retry_delay': timedelta(minutes=1)
},
description='Send slack notification using SlackWebhookOperator',
schedule_interval= None,
start_date=datetime(2021, 1, 1),
catchup=False,
tags=\['POC','SNOW-ALERT'\]
) as dag:

    slack_msg = "Testing SlackWebhookOperator from TEST MWAA"
    
    slack_test =  SlackWebhookOperator(
            task_id='slack_test',
            http_conn_id='slack_connector',
            webhook_token='/XXXX/XXXX/XXXX',
            message=slack_msg,
            channel='#test-airflow-snow-alerts',
            username='Airflow TEST MWAA',
            icon_emoji=None,
            link_names=False,
            dag=dag)
    
    slack_test

Issue description

When executing the DAG slack_operator_validation, the task 'slack_test' fails with the following error: [2023-01-19, 02:07:39 UTC] {{client.py:216}} ERROR - Failed to send a request to Slack API server: <urlopen error EOF occurred in violation of protocol (_ssl.c:1091)>

After some investigation I found this thread where a couple of folks have resolved the issue by installing ndg-httpsclient & pyasn1 libs. With that in mind I applied a terraform change to install these packages into MWAA environment and it succeeded. However it didn’t fix the issue.

0 Answers0