M-Waleed-Khan opened a new issue, #37533:
URL: https://github.com/apache/airflow/issues/37533

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.7.2
   
   ### What happened?
   
   I was using Apache 2.2.4 and everything was working fine. I recently 
upgraded my env to Apache 2.7.2. Now, In one of my dag failure I am not able to 
get the slack notification because it says the above error.
   
    I am using this code below
    
    `failed_alert = SlackAPIPostOperator(
           task_id='slack_failed',
           channel=channel,
           token=token,
           username=user,
           text="""
                   :red_circle: Task Failed. 
                   *Task*: {task}  
                   *Dag*: {dag} 
                   *Execution Time*: {exec_date}  
                   *Error* : {errormessage}
                   *Log Url*: {log_url} 
           """.format(
               task=context.get('task_instance').task_id,
               dag=context.get('task_instance').dag_id,
               ti=context.get('task_instance'),
               exec_date=context.get('execution_date'),
               log_url=context.get('task_instance').log_url,
               errormessage=context.get('exception')
           )
       )
   
       return failed_alert.execute(context=context)`
   
   
   The error that I am getting is this
   
   `Traceback (most recent call last):
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/airflow/models/taskinstance.py",
 line 1702, in _run_finished_callback
       callback(context)
     File "/usr/local/airflow/dags/scripts/slack_logger.py", line 11, in 
slack_failed_task
       failed_alert = SlackAPIPostOperator(
                      ^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/airflow/models/baseoperator.py",
 line 437, in apply_defaults
       result = func(self, **kwargs, default_args=default_args)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/airflow/providers/slack/operators/slack.py",
 line 131, in __init__
       super().__init__(method=self.method, **kwargs)
     File 
"/usr/local/airflow/.local/lib/python3.11/site-packages/airflow/models/baseoperator.py",
 line 420, in apply_defaults
       raise AirflowException(f"missing keyword argument 
{missing_args.pop()!r}")
   airflow.exceptions.AirflowException: missing keyword argument 
'slack_conn_id'`
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   be calling the SlackAPIPostOperator
   
   ### Operating System
   
   Mac and AWS MWAA both same
   
   ### Versions of Apache Airflow Providers
   
   Current version
   apache-airflow-providers-slack==8.1.0
   Previous working version
   apache-airflow-providers-slack==4.2.0
   
   ### Deployment
   
   Amazon (AWS) MWAA
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to