Description
There is a bug in util/connectors.py inside the UrlInvoker.invoke() method that prevents actual Microsoft Graph API errors from being logged.
When a batch request fails (e.g., a 400 or 500 status code), the MS Graph API returns a JSON error response. The requests library parses this JSON body into a Python dictionary. However, the logging mechanism attempts to use ",".join() directly on these dictionary objects, which causes a type mismatch crash.
Root Cause
Around line 84 in util/connectors.py:
if len(failed_responses) > 0:
logger(f"Consistent failures observed for the following: {','.join(response.get('body') for response in failed_responses)}")
Because response.get("body") is a dict, ",".join() throws a TypeError: sequence item 0: expected str instance, dict found.
Furthermore, because this line is wrapped inside a broad try...except Exception as e: block, the TypeError is caught and logged as the actual error. This completely masks the underlying MS Graph API error, making it incredibly difficult to debug API failures.
Expected Behavior
The application should safely stringify the API error payload and log it, allowing developers to see exactly why the Graph API rejected the request (e.g., {"error": {"message": "Invalid ID"}}).
Actual Behavior
The application swallows the API error and instead logs a Python syntax error:
Error in : sequence item 0: expected str instance, dict found
Description
There is a bug in
util/connectors.pyinside theUrlInvoker.invoke()method that prevents actual Microsoft Graph API errors from being logged.When a batch request fails (e.g., a 400 or 500 status code), the MS Graph API returns a JSON error response. The
requestslibrary parses this JSON body into a Python dictionary. However, the logging mechanism attempts to use",".join()directly on these dictionary objects, which causes a type mismatch crash.Root Cause
Around line 84 in
util/connectors.py:Because response.get("body") is a dict, ",".join() throws a TypeError: sequence item 0: expected str instance, dict found.
Furthermore, because this line is wrapped inside a broad try...except Exception as e: block, the TypeError is caught and logged as the actual error. This completely masks the underlying MS Graph API error, making it incredibly difficult to debug API failures.
Expected Behavior
The application should safely stringify the API error payload and log it, allowing developers to see exactly why the Graph API rejected the request (e.g., {"error": {"message": "Invalid ID"}}).
Actual Behavior
The application swallows the API error and instead logs a Python syntax error:
Error in : sequence item 0: expected str instance, dict found