Skip to content

Function arg list mismatch between provider code and main code when using AWS SES #21878

@zachliu

Description

@zachliu

Apache Airflow version

2.2.4 (latest released)

What happened

After setting up alert emails using AWS SES as instructed here, I received the following error message:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 2103, in email_alert
    send_email(self.task.email, subject, html_content)
  File "/usr/local/lib/python3.8/site-packages/airflow/utils/email.py", line 57, in send_email
    return backend(
TypeError: send_email() got multiple values for argument 'from_email'

What you expected to happen

the send_email method in

def send_email(
from_email: str,
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',
**kwargs,
) -> None:
doesn't match the invocation of the backend method in
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,
from_email=from_email,
**kwargs,
)

in the former (provider-amazon), the from_email is the first positional argument. However in the latter (main airflow), from_email is misplaced as a keyword argument.

How to reproduce

  1. Use Airflow 2.2.4 with providers-amazon/3.0.0
  2. Observe the log from a failed DAG

Operating System

Amazon Linux 2

Versions of Apache Airflow Providers

apache-airflow-providers-amazon 3.0.0

Deployment

Other Docker-based deployment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions