obarisk opened a new issue, #55679:
URL: https://github.com/apache/airflow/issues/55679

   ### Apache Airflow Provider(s)
   
   slack
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-slack=9.2.0
   
   
   ### Apache Airflow version
   
   3.1.0b1
   
   ### Operating System
   
   debian bookworm
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   podman with similar configuration as docker-compose.
   
   ### What happened
   
   In the following snippet,
   `must_fail` should send a notification (on_failure)
   `manual_notification` should send a notification (use slack hook directly).
   
   but no nofiticaion fired and there're errors/exceptions instead.
   the error message 
   
   ```text
   Failed to send notification (sync): 'AirflowBoundLoggerFilteringAtInfo' 
object has no attribute 'level': 
source="airflow.providers.slack.notifications.slack_webhook.SlackWebhookNotifier
   AttributeError: 'AirflowBoundLoggerFilteringAtInfo' object has no attribute 
'level'
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/task_runner.py",
 line 1179 in _run_task_state_change_callbacks
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/callback_runner.py",
 line 82 in run
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/bases/notifier.py",
 line 138 in __call__
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/slack/notifications/slack_webhook.py",
 line 90 in notify
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/slack/hooks/slack_webhook.py",
 line 301 in send
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/slack/hooks/slack_webhook.py",
 line 53 in wrapper
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/slack/hooks/slack_webhook.py",
 line 243 in send_dict
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/slack_sdk/webhook/client.py",
 line 137 in send_dict
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/slack_sdk/webhook/client.py",
 line 146 in _perform_http_request
   
   File 
"/home/airflow/.local/lib/python3.12/site-packages/structlog/_config.py", line 
420 in __getattr__
   ```
   
   
   ### What you think should happen instead
   
   notification fired correctly
   
   ### How to reproduce
   
   use docker image `docker.io/apache/airflow:3.1.0b1-python3.12`
   
   ```python
   from airflow.providers.slack.hooks.slack_webhook import SlackWebhookHook
   from airflow.providers.slack.notifications.slack_webhook import (
     send_slack_webhook_notification,
   )
   from airflow.sdk import dag, task
   from slack_sdk import WebhookClient
   
   
   @dag(
     schedule=None,
     default_args={
       "on_failure_callback": [
         send_slack_webhook_notification(
           slack_webhook_conn_id="slack_default",
           text="failure"
         ),
       ],
     },
     tags=["qa"],
   )
   def demo_notification():
     @task
     def must_fail():
       raise ValueError("This task is supposed to fail")
   
     @task
     def manual_notification():
       slack_client: WebhookClient = SlackWebhookHook(
         slack_webhook_conn_id="slack_default"
       )
       slack_client.send(text="hello world")
   
     manual_notification()
     must_fail()
   
   demo_notification()
   ```
   
   ### Anything else
   
   no idea if related to #55237 
   
   ### 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