fix: prevent webhook_endpoint extra field from being sent as HTTP header in DiscordWebhookHook#65398
Open
charmikadi wants to merge 2 commits intoapache:mainfrom
Open
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
Override get_conn to prevent webhook_endpoint from being sent as an HTTP header.
Fixed issue with DiscordWebhookHook sending webhook_endpoint as an HTTP header, resulting in 400 Bad Request errors after Airflow 3.2 update.
571df59 to
e91c1ed
Compare
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.
When using DiscordWebhookHook with a connection that stores webhook_endpoint in the extra field, Airflow 3.2 now injects remaining connection extra fields as HTTP request headers via HttpHook.get_conn(). This causes Discord to
reject the request with 400 Bad Request because webhook_endpoint is not a valid HTTP header.
The fix overrides get_conn in DiscordWebhookHook to remove webhook_endpoint from the connection's extra fields before HttpHook processes them. Since webhook_endpoint is used to build the request URL, not as an HTTP header,
it should never be sent to Discord. The original extra is restored in a finally block to avoid any side effects.
Closes #65279
Was generative AI tooling used to co-author this PR?