Fix HttpOperator(deferrable=True) crash when connection has login / password#52050
Merged
potiuk merged 4 commits intoapache:mainfrom Jun 23, 2025
Merged
Fix HttpOperator(deferrable=True) crash when connection has login / password#52050potiuk merged 4 commits intoapache:mainfrom
potiuk merged 4 commits intoapache:mainfrom
Conversation
potiuk
approved these changes
Jun 23, 2025
Member
|
Great catch and good implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #46863
Why
If an HTTP connection contains login/password and the user doesn't set
auth_type, the sync path works (the hook auto-defaults to HTTPBasicAuth), but the deferrable path crashes:airflow/providers/http/src/airflow/providers/http/operators/http.py
Lines 220 to 224 in a8a9fc5
passes
Nonetoauth_type, store it in thetriggertable.id | classpath | kwargs | created_date | triggerer_id ----+--------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------------------------+-------------- 3 | airflow.providers.http.triggers.http.HttpTrigger | {"__var": {"http_conn_id": "http_default", "method": "GET", "auth_type": null, "endpoint": "get", "headers": {"__var": {}, "__type": "dict"}, "data": {"__var": {}, "__type": "dict"}, "extra_options": {"__var": {}, "__type": "dict"}}, "__type": "dict"} | 2025-06-18 04:01:51.49263+00 | 3 (1 row)after deserialization,
Noneis passed here, causing'NoneType' object is not callableerror.airflow/providers/http/src/airflow/providers/http/hooks/http.py
Lines 439 to 440 in a8a9fc5
How
Add
_resolve_auth_type()to HttpOperator;it auto-picks
aiohttp.BasicAuth(when the conn has login/password) before deferral.Add
serialize_auth_type(); always store the fully-qualified class path orNone.Add
deserialize_auth_type();HttpTrigger.__init__()uses it to turn the stored string back into the class object at runtime.Serialize
auth_typewhenHttpOperator.execute_async()and deserialises it whenHttpTrigger.__init__(),so internal logic remains unchanged.
What
Test DAG
Test connection
before

after

the
auth_typein thetriggertableid | classpath | kwargs | created_date | triggerer_id ----+--------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------+-------------- 1 | airflow.providers.http.triggers.http.HttpTrigger | {"__var": {"http_conn_id": "http_default", "method": "GET", "auth_type": "aiohttp.helpers.BasicAuth", "endpoint": "get", "headers": {"__var": {}, "__type": "dict"}, "data": {"__var": {}, "__type": "dict"}, "extra_options": {"__var": {}, "__type": "dict"}}, "__type": "dict"} | 2025-06-19 22:52:32.606647+00 | 2 (1 row)