Skip to content

Handle non-dictionary json payload during logging to avoid internal server error.#62355

Merged
pierrejeambrun merged 1 commit intoapache:mainfrom
tirkarthi:gh62354
Feb 23, 2026
Merged

Handle non-dictionary json payload during logging to avoid internal server error.#62355
pierrejeambrun merged 1 commit intoapache:mainfrom
tirkarthi:gh62354

Conversation

@tirkarthi
Copy link
Copy Markdown
Contributor

action_logging logs the masked payload for endpoints accepting json payload. But a list is also a valid json and in this case iterating through with items causes AttributeError and internal server error. This change skips logging and lets FastAPI handle payload structure validation. After this PR 422 status code will be returned with proper error message instead of internal server error.

This still results in audit log entry like below though but validating for all payloads to be dictionary feels very restrictive and something that should be handled at FastAPI layer instead.

*************************** 289. row ***************************
                id: 289
              dttm: 2026-02-23 18:58:33.799714
            dag_id: example_complex
           task_id: NULL
         map_index: NULL
             event: trigger_dag_run
      logical_date: NULL
            run_id: NULL
             owner: admin
owner_display_name: admin
             extra: {"method": "POST"}
        try_number: NULL

closes: #62354

Was generative AI tooling used to co-author this PR?

No

Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@pierrejeambrun pierrejeambrun added this to the Airflow 3.1.8 milestone Feb 23, 2026
@pierrejeambrun pierrejeambrun merged commit 46a433d into apache:main Feb 23, 2026
129 checks passed
github-actions Bot pushed a commit that referenced this pull request Feb 23, 2026
…d internal server error. (#62355)

(cherry picked from commit 46a433d)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

Backport successfully created: v3-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-1-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Feb 23, 2026
…d internal server error. (apache#62355)

(cherry picked from commit 46a433d)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
xvega pushed a commit to xvega/airflow that referenced this pull request Feb 24, 2026
pierrejeambrun pushed a commit that referenced this pull request Feb 24, 2026
…d internal server error. (#62355)

(cherry picked from commit 46a433d)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
pierrejeambrun pushed a commit that referenced this pull request Feb 24, 2026
…d internal server error. (#62355) (#62367)

(cherry picked from commit 46a433d)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
@tirkarthi
Copy link
Copy Markdown
Contributor Author

Thanks @pierrejeambrun for the review and merge.

@tirkarthi tirkarthi deleted the gh62354 branch February 24, 2026 14:14
vatsrahul1001 pushed a commit that referenced this pull request Mar 4, 2026
…d internal server error. (#62355) (#62367)

(cherry picked from commit 46a433d)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
dominikhei pushed a commit to dominikhei/airflow that referenced this pull request Mar 11, 2026
Ankurdeewan pushed a commit to Ankurdeewan/airflow that referenced this pull request Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal server error on using list as payload to endpoints with action_logging enabled

2 participants