dada-engineer opened a new issue, #56025:
URL: https://github.com/apache/airflow/issues/56025

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Disclaimer: We use the 3.1.0rc2 for remote logging fix reasons with AWS S3.
   
   I do want to trigger a dag from within the UI (or actually whenever a dagRun 
POST request is sent), but it fails with internal server error.
   
   ```
   ERROR:    Exception in ASGI application
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py",
 line 409, in run_asgi
       result = await app(  # type: ignore[func-returns-value]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/fastapi/applications.py", 
line 1082, in __call__
       await super().__call__(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/applications.py", 
line 113, in __call__
       await self.middleware_stack(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/errors.py",
 line 186, in __call__
       raise exc
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/errors.py",
 line 164, in __call__
       await self.app(scope, receive, _send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/gzip.py",
 line 29, in __call__
       await responder(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/gzip.py",
 line 130, in __call__
       await super().__call__(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/gzip.py",
 line 46, in __call__
       await self.app(scope, receive, self.send_with_compression)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/cors.py",
 line 93, in __call__
       await self.simple_response(scope, receive, send, request_headers=headers)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/cors.py",
 line 144, in simple_response
       await self.app(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/middleware/exceptions.py",
 line 63, in __call__
       await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/_exception_handler.py",
 line 53, in wrapped_app
       raise exc
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/_exception_handler.py",
 line 42, in wrapped_app
       await app(scope, receive, sender)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/routing.py", line 
716, in __call__
       await self.middleware_stack(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/routing.py", line 
736, in app
       await route.handle(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/routing.py", line 
290, in handle
       await self.app(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/routing.py", line 
78, in app
       await wrap_app_handling_exceptions(app, request)(scope, receive, send)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/_exception_handler.py",
 line 53, in wrapped_app
       raise exc
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/_exception_handler.py",
 line 42, in wrapped_app
       await app(scope, receive, sender)
     File 
"/home/airflow/.local/lib/python3.12/site-packages/starlette/routing.py", line 
75, in app
       response = await f(request)
                  ^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/fastapi/routing.py", line 
298, in app
       solved_result = await solve_dependencies(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/fastapi/dependencies/utils.py",
 line 674, in solve_dependencies
       ) = await request_body_to_args(  # body_params checked above
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/fastapi/dependencies/utils.py",
 line 938, in request_body_to_args
       v_, errors_ = _validate_value_with_model_field(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/fastapi/dependencies/utils.py",
 line 714, in _validate_value_with_model_field
       v_, errors_ = field.validate(value, values, loc=loc)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/fastapi/_compat.py", line 
130, in validate
       self._type_adapter.validate_python(value, from_attributes=True),
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/pydantic/type_adapter.py", 
line 421, in validate_python
       return self.validator.validate_python(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/core_api/datamodels/dag_run.py",
 line 110, in check_data_intervals
       if (values.data_interval_start is None) != (values.data_interval_end is 
None):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```
   
   I think this is due to 
[TriggerDAGRunPostBody](https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dag_run.py#L109)
 model validator signature being wrong (not sure if it was changed from before 
to after but according to [pydantic 
docs](https://docs.pydantic.dev/latest/concepts/validators/#model-after-validator)
 the after validator receives the model instance itself, and if another param 
is used a ValidationInfo object. The signature looks like this has been a 
before validator once).
   
   ### What you think should happen instead?
   
   The validation should be using the model instance and it should not fail 
with an Attribute error for a pydantic internal thing.
   
   ### How to reproduce
   
   Send any post request to the dagRun endpoint
   
   ### Operating System
   
   debian bookworm (We use the released docker image)
   
   ### 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?
   
   - [x] 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