question

Office365Dev-8057 avatar image
0 Votes"
Office365Dev-8057 asked saldana-msft edited

Microsoft graph Api : While tring to download file from onedrive through graph api , It is throwing ClientException.

We are trying to download one file from onedrive file using the following endpoint call through microsoft graph api https://graph.microsoft.com/v1.0/me/drive/items/012HV4LEMQTONTSFH3KZA3RUPLOCHKHIV4/content But getting the following exception :

com.microsoft.graph.core.ClientException: Error during http request at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:422) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:204) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:184) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:306) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.http.CustomRequest.get(CustomRequest.java:43) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.automationanywhere.botcommand.onedrive.commands.DownloadDriveItem.execute(DownloadDriveItem.java:116) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.automationanywhere.botcommand.onedrive.commands.DownloadDriveItemCommand.execute(DownloadDriveItemCommand.java:80) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.automationanywhere.botrunner.bot.Bot_Content.executeNode18(Bot_Content.java:335) ~[?:?] at com.automationanywhere.botrunner.bot.Bot_Content.play(Bot_Content.java:444) ~[?:?] at com.automationanywhere.botrunner.Main.play(Main.java:63) ~[?:?] at com.automationanywhere.botengine.service.impl.BotLauncherImpl.runBot(BotLauncherImpl.java:22) ~[bot-launcher.jar:?] at com.automationanywhere.botengine.service.impl.DispatcherImpl.lambda$start$8(DispatcherImpl.java:358) ~[bot-launcher.jar:?] at com.automationanywhere.botengine.utils.ThreadUtil.lambda$withThreadContext$0(ThreadUtil.java:20) ~[bot-launcher.jar:?] at java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) [?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?] at java.lang.Thread.run(Unknown Source) [?:?] Caused by: java.lang.IllegalStateException: cannot make a new request because the previous response is still open: please call response.close() at okhttp3.internal.connection.RealCall.enterNetworkInterceptorExchange(RealCall.kt:229) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:66) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.httpcore.TelemetryHandler.intercept(TelemetryHandler.java:37) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.httpcore.RedirectHandler.intercept(RedirectHandler.java:123) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.httpcore.RetryHandler.intercept(RetryHandler.java:140) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.httpcore.AuthenticationHandler.intercept(AuthenticationHandler.java:31) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:356) ~[bot-command-onedrive-2.2.0-20210127-131519.jar:?] ... 16 more





We did more analysis from our side and mentioned the same below.

We are using microsoft graph version 1.7.1 jar to download file from onedrive. The jar using by default version 3.12.1 of com.squareup.okhttp3 .

But this version(3.12.1) has some vulnerability , hence we overridden default version of com.squareup.okhttp3 to "4.8.0" 6-8 months back . With this new version of com.squareup.okhttp3 , microsoft graph services was working fine , but from some time back , suddenly it start throwing this error/exception.

Then I tried to revert back version of com.squareup.okhttp3 means from "4.8.0" to default("3.12.1") , "download file from onedrive" service start working again.

It seems that "4.8.0" version of com.squareup.okhttp3 is not compactible with microsoft graph version 1.7.1 for some of rest service like "download file from onedrive", "export pdf from onedrive" etc.

Please look into this issue asap. It has blocked some of our urgent deliverables.

Thanks for understanding.

microsoft-graph-sdkmicrosoft-graph-files
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

VincentBiret avatar image
0 Votes"
VincentBiret answered

Hi,
Thanks for reaching out. Version 1.7.1 was never designed to work with a different major version of okhttp.
Version 3 of the SDK features many improvements, including the upgrade of dependencies to their latest versions, you can check out the upgrade to v3 guide to know more about the different improvements.
Please upgrade your application to v3 and see if the problem still happens.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.