Skip to content

GraphClient me().events().byEventid(...) throws RuntimeException on unexpected request response type text/html #2234

@etcoyvindf

Description

@etcoyvindf

Describe the bug

We run an outlook calendar integration through Graph API, using msgraph-sdk-java.

When syncing calendar items to our internal DB we fetch an existing event with code:
graphClient.me().events().byEventId(id).get(rc -> addStandardOutlookRequestHeaders(rc.headers));

Today, we experienced some issues, possibly related to MS365 Issue ID MO941162. See stacktrace below

Expected behavior

Unexpected response from the API should be handled by the SDK properly and not throw a raw RuntimeException.
Other errors throw a kiota ApiException which might be fitting here

How to reproduce

Since the issue seems to be intermittent, we have not been able to reproduce it. Possibly setting up a proxy server that returns html instead of JSON might provoke the same behaviour.

SDK Version

6.20.0

Latest version known to work for scenario above?

6.20.0

Known Workarounds

Catch and parse exception message and retry the request.

Debug output

Click to expand log ``` The request above resulted in the following stacktrace:

java.lang.RuntimeException: Content type text/html does not have a factory to be parsed
at com.microsoft.kiota.serialization.ParseNodeFactoryRegistry.getParseNode(ParseNodeFactoryRegistry.java:56)
at com.microsoft.kiota.http.OkHttpRequestAdapter.getRootParseNode(OkHttpRequestAdapter.java:582)
at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:649)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:280)
at com.microsoft.graph.users.item.events.item.EventItemRequestBuilder.get(EventItemRequestBuilder.java:176)
... internal code stack here

</details>


### Configuration

Linux: x64
Java 21

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions