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

   ### Apache Airflow version
   
   3.1.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   The current schema constraint for `DbCallbackRequest.callback_type` doesn’t 
support recording `EmailNotificationRequest` in the `callback_request` table 
because the string length limit is 20 characters.
   
   This schema constraint is blocking the `_run_scheduler_loop` which is faling 
to emit the scheduler heartbeat.
   
   code : 
https://github.com/apache/airflow/blob/3.1.0/airflow-core/src/airflow/models/db_callback_request.py#L42C28-L42C34
   
   ### What you think should happen instead?
   
   As default, it uses the `EmailNotificationRequest` for email notification. 
we can should increase the string length that support the native class of 
airflow. 
   
   ### How to reproduce
   
   **Prerequisites:**
   SMTP configured (or any email backend)
   
   code 
   
   ```
   from datetime import datetime, timedelta
   from airflow import DAG
   from airflow.operators.python import PythonOperator
   
   def failing_task():
       """This task will always fail to trigger email notification."""
       raise Exception("This task intentionally fails to reproduce the email 
callback issue")
   
   default_args = {
       'owner': 'test',
       'email': ['[email protected]'],  # Configure your email here
       'email_on_failure': True,       # This triggers the bug
       'email_on_retry': False,
       'retries': 0,                   # No retries to fail faster
   }
   
   dag = DAG(
       'reproduce_email_callback_bug',
       default_args=default_args,
       description='Simple DAG to reproduce EmailNotificationRequest database 
constraint issue',
       schedule_interval=None,         # Manual trigger only
       start_date=datetime(2024, 1, 1),
       catchup=False,
   )
   
   # Task that will fail and trigger email notification
   fail_task = PythonOperator(
       task_id='intentional_failure',
       python_callable=failing_task,
       dag=dag,
   )
   ```
   
   run the above dag in airflow . 
   
   Task fails → Scheduler tries to send email notification
   Scheduler crashes with error:
      sqlalchemy.exc.DataError: (psycopg2.errors.StringDataRightTruncation) 
      value too long for type character varying(20)
    
   
   
   ### Operating System
   
   PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" 
VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian 
HOME_URL="https://www.debian.org/"; SUPPORT_URL="https://www.debian.org/support"; 
BUG_REPORT_URL="https://bugs.debian.org/";
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### 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
   
   - [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