kduvzc opened a new issue #20629:
URL: https://github.com/apache/airflow/issues/20629


   ### Apache Airflow Provider(s)
   
   slack
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon==1.3.0
   apache-airflow-providers-ftp==2.0.1
   apache-airflow-providers-http==2.0.1
   apache-airflow-providers-imap==2.0.1
   apache-airflow-providers-postgres==2.4.0
   apache-airflow-providers-slack==4.1.0
   apache-airflow-providers-sqlite==2.0.1
   
   ### Apache Airflow version
   
   2.0.2
   
   ### Operating System
   
   Unknown... running on AWS MWAA
   
   ### Deployment
   
   MWAA
   
   ### Deployment details
   
   Using docker-compose with https://github.com/aws/aws-mwaa-local-runner
   
   ### What happened
   
   When defining the slack webhook operator as follows,
   
   ```
   from airflow.hooks.base import BaseHook
   from airflow.providers.slack.operators.slack_webhook import 
SlackWebhookOperator
   
   ...
   
   slack_webhook_operator = SlackWebhookOperator(
           task_id='slack_test',
           http_conn_id=my_connection_id,                   # stored in AWS 
Secrets Manager
           channel=channel,
           message="Testing new SlackWebHookOperator on AWS Managed Airflow 
(MWAA)",
           webhook_token=BaseHook.get_connection(conn_id).password,
           username=username)
   ```
   
   we get the following error in the DAG execution log:
   
   ```
   requests.exceptions.InvalidSchema: No connection adapters were found for 
'"SecretName":"XXX","SecretString":"https://hooks.slack.com://YYY"}'
   ```
   
   where `XXX` is the name of the `my_connection_id` used in the DAG and `YYY` 
the slack webhook token stored in the password field of the connection.
   
   I presume this is happening because the SlackWebhookOperator isn't behaving 
as expected when fetching the connection from AWS Secrets Manager.
   
   
   ### What you expected to happen
   
   The error mentioned
   
   ```
   requests.exceptions.InvalidSchema: No connection adapters were found for 
'"SecretName":"XXX","SecretString":"https://hooks.slack.com://YYY"}'
   ```
   
   is there because the SlackWebhookOperator argument 
`http_conn_id=my_connection_id` is fetching the JSON object
   
   ```
   '{"SecretName":"XXX","SecretString":"https://hooks.slack.com://YYY"}'
   ```
   
   instead of just returning the `SecretString` value.
   
   ### How to reproduce
   
   _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