You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/02/18 18:16:30 UTC
[GitHub] [airflow] dbarrundiag opened a new issue #21671: Amazon Airflow Provider | Broken AWS SES as backend for Email
dbarrundiag opened a new issue #21671:
URL: https://github.com/apache/airflow/issues/21671
### Apache Airflow Provider(s)
amazon
### Versions of Apache Airflow Providers
```
apache-airflow==2.2.2
apache-airflow-providers-amazon==2.4.0
```
### Apache Airflow version
2.2.2
### Operating System
Amazon Linux 2
### Deployment
MWAA
### Deployment details
_No response_
### What happened
As part of this PR https://github.com/apache/airflow/pull/18042 the signature of the function `airflow.providers.amazon.aws.utils.emailer.send_email` is no longer compatible with how `airflow.utils.email.send_email` invokes the function. Essentially the functionally of using SES as Email Backend is broken.
### What you expected to happen
This behavior is erroneous because the signature of `airflow.providers.amazon.aws.utils.emailer.send_email` should be compatible with how we call the backend function in `airflow.utils.email.send_email`:
```
return backend(
to_comma_separated,
subject,
html_content,
files=files,
dryrun=dryrun,
cc=cc,
bcc=bcc,
mime_subtype=mime_subtype,
mime_charset=mime_charset,
conn_id=backend_conn_id,
**kwargs,
)
```
### How to reproduce
## Use AWS SES as Email Backend
[email]
email_backend = airflow.providers.amazon.aws.utils.emailer.send_email
email_conn_id = aws_default
## Try sending an Email
```
from airflow.utils.email import send_email
def email_callback(**kwargs):
send_email(to=['test@hello.io'], subject='test', html_content='content')
email_task = PythonOperator(
task_id='email_task',
python_callable=email_callback,
)
```
## The bug shows up
```
File "/usr/local/airflow/dags/environment_check.py", line 46, in email_callback
send_email(to=['test@hello.io'], subject='test', html_content='content')
File "/usr/local/lib/python3.7/site-packages/airflow/utils/email.py", line 66, in send_email
**kwargs,
TypeError: send_email() missing 1 required positional argument: 'html_content'
```
### Anything else
Every time.
### 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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk commented on issue #21671: Amazon Airflow Provider | Broken AWS SES as backend for Email
Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #21671:
URL: https://github.com/apache/airflow/issues/21671#issuecomment-1045021786
Thsnks for this one.
The workaround is to implement own function (below) or downgrade the amazon provider to 2.3.0
```
def my_send_email(
to: Union[List[str], str],
subject: str,
html_content: str,
files: Optional[List] = None,
cc: Optional[Union[List[str], str]] = None,
bcc: Optional[Union[List[str], str]] = None,
mime_subtype: str = 'mixed',
mime_charset: str = 'utf-8',
conn_id: str = 'aws_default',
from_email: str = None,
**kwargs,
) -> None:
"""Email backend for SES."""
hook = SESHook(aws_conn_id=conn_id)
hook.send_email(
mail_from=from_email,
to=to,
subject=subject,
html_content=html_content,
files=files,
cc=cc,
bcc=bcc,
mime_subtype=mime_subtype,
mime_charset=mime_charset,
)
```
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dbarrundiag commented on issue #21671: Amazon Airflow Provider | Broken AWS SES as backend for Email
Posted by GitBox <gi...@apache.org>.
dbarrundiag commented on issue #21671:
URL: https://github.com/apache/airflow/issues/21671#issuecomment-1044956864
CC: @potiuk
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] boring-cyborg[bot] commented on issue #21671: Amazon Airflow Provider | Broken AWS SES as backend for Email
Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #21671:
URL: https://github.com/apache/airflow/issues/21671#issuecomment-1044955881
Thanks for opening your first issue here! Be sure to follow the issue template!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] dbarrundiag commented on issue #21671: Amazon Airflow Provider | Broken AWS SES as backend for Email
Posted by GitBox <gi...@apache.org>.
dbarrundiag commented on issue #21671:
URL: https://github.com/apache/airflow/issues/21671#issuecomment-1045514363
FYI: @uranusjr @ignaski
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] potiuk closed issue #21671: Amazon Airflow Provider | Broken AWS SES as backend for Email
Posted by GitBox <gi...@apache.org>.
potiuk closed issue #21671:
URL: https://github.com/apache/airflow/issues/21671
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org