Skip to content

fix(connectors): safely stringify failed batch response bodies before logging - #208

Open
PANYAMHEMANTH wants to merge 3 commits into
google:mainfrom
PANYAMHEMANTH:fix/graph-batch-error-logging
Open

PANYAMHEMANTH wants to merge 3 commits into
google:mainfrom
PANYAMHEMANTH:fix/graph-batch-error-logging

Conversation

@PANYAMHEMANTH

Copy link
Copy Markdown

Fixes #63

Summary

UrlInvoker.invoke() logged failed Microsoft Graph batch responses by joining
response["body"] values with a comma-joined string operation. Graph API error
payloads are JSON objects, so join raises a TypeError, which the broad
exception handler then swallowed and logged instead of the real API error.

Failed response bodies are now serialized with json.dumps when they are
dicts/lists and stringified otherwise, before being joined into the log line.

Testing

  • Added tests/util/connectors_test.py regression test for the batch
    failure-logging path; it fails with the old code and passes with the fix.
… logging

Failed Microsoft Graph batch responses carry JSON error bodies, but the
failure logging joined response["body"] values with a comma-joined string
operation, which raises a TypeError for dict payloads. The broad exception
handler swallowed that TypeError and logged it instead of the real API error.

Failed responses are now serialized with json.dumps when the body is a dict
or list, and stringified otherwise, before being joined into the log line.

Assisted-by: DeepSeek V4.1 Flash Free (OpenCode)
@google-cla

google-cla Bot commented Oct 29, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@PANYAMHEMANTH

Copy link
Copy Markdown
Author

The Google CLA check is green now and the change is ready for review. Could a maintainer take a look when they have a moment? I am happy to adjust anything.

@PANYAMHEMANTH

Copy link
Copy Markdown
Author

@NityamPareek — small follow-up in the same area as #209. UrlInvoker.invoke logged Consistent failures observed for the following: by joining response.get("body") values, which raises TypeError when a Graph batch failure body is a dict (the usual case), and that exception was then swallowed by the surrounding except, hiding the real failures. This stringifies dict/list bodies with json.dumps() before joining and adds a regression test whose failure body is a dict. pytest tests/util/connectors_test.py passes. The Google workflow security scan is action_required for a first-time contributor; could you approve it and take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant