Skip to content

fix: log failed Zoom responses whose body is not JSON - #19

Merged
harshtandiya merged 1 commit into
mainfrom
fix/log-non-json-zoom-errors
Sep 30, 2026
Merged

harshtandiya merged 1 commit into
mainfrom
fix/log-non-json-zoom-errors

Conversation

@harshtandiya

Copy link
Copy Markdown
Contributor

What

A failed Zoom call whose body isn't JSON (a gateway error page, an empty body) crashed inside the logging and hid Zoom's actual error.

File "zoom_integration/api.py", line 24, in create_zoom_session
    create_request_log(response.text, ...)
File "frappe/integrations/utils.py", line 187, in create_request_log
    data = json.loads(data)
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

create_request_log runs json.loads on any string it gets as data, and the failure paths handed it response.text.

Changes

  • log_failed_response(response) in api.py: logs {"status_code": ...} as data and the body as error (text, never parsed).
  • Used on all four failure paths: meeting create and add registrant in api.py, webinar create and add registrant in zoom_webinar.py.
  • The thrown messages now carry the status code: Failed to create meeting on Zoom (502): ....

Not changed

  • Success paths still log the parsed JSON as before.
  • authenticate() still does response.json()["access_token"], so bad credentials surface as a KeyError. Separate fix.

Testing

  • New test_a_failure_with_a_non_json_body_is_logged_and_reported: a 502 with an HTML body raises ValidationError mentioning 502 and leaves one Failed Integration Request with the status and body. It failed with the JSONDecodeError above before the fix.
  • test_request_logging 2/2, test_api 8/8, test_zoom_webinar 4/4.

create_request_log parses a string as JSON, and failed calls handed it
response.text. A gateway error or an empty body then raised
JSONDecodeError, which replaced Zoom's real error and left nothing in the
Integration Request log.

Failed calls now log the status code as data and the body as text, and
their error messages carry the status code.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@harshtandiya
harshtandiya merged commit eedb6e2 into main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant