potiuk commented on issue #18495: URL: https://github.com/apache/airflow/issues/18495#issuecomment-927951133
I did not use sendgrid so I am not sure but from the code it looks like API_KEY is taken from connection password. I do not think host is ever used. You just have to make sure your connection is named 'sendgrid_default". You can also try env variable to test if your key is correct (see below): The error 400 has nothing to do with password - it is `Bad request` - so if anything this might be a bad version of sendgrid dependency, wrong provider, or maybe wrong format of the KEY? You need to consult sendgrid docs: From: https://github.com/apache/airflow/blob/main/airflow/providers/sendgrid/utils/emailer.py ``` def _post_sendgrid_mail(mail_data: Dict, conn_id: str = "sendgrid_default") -> None: api_key = None try: conn = BaseHook.get_connection(conn_id) api_key = conn.password except AirflowException: pass if api_key is None: warnings.warn( "Fetching Sendgrid credentials from environment variables will be deprecated in a future " "release. Please set credentials using a connection instead.", PendingDeprecationWarning, stacklevel=2, ) api_key = os.environ.get('SENDGRID_API_KEY') sendgrid_client = sendgrid.SendGridAPIClient(api_key=api_key) response = sendgrid_client.client.mail.send.post(request_body=mail_data) # 2xx status code. if 200 <= response.status_code < 300: log.info( 'Email with subject %s is successfully sent to recipients: %s', mail_data['subject'], mail_data['personalizations'], ) else: log.error( 'Failed to send out email with subject %s, status code: %s', mail_data['subject'], response.status_code, ) ``` -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org