question

VenkteshBirla-0606 avatar image
0 Votes"
VenkteshBirla-0606 asked VenkteshBirla-0606 answered

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 I am using this api from long time in our project and it was working fine. We have not done any changes recently , but we start getting the exception from last 1-2 days. Please help us to resolve this issue. Thanks

microsoft-graph-sdk
· 4
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.

The endpoint seems to be working well on my end. Could you please share the request id and timestamp of this particular call you made?

0 Votes 0 ·

Please have a look at the stacktrace. Its telling that you're trying to making a new request, when the previous response is still open due to that the above error is thrown. So make sure that you call response.close() and make the new request to see if it works. If you can still repro the issue, please share the info requested above.

0 Votes 0 ·

Making calls to OneDrive is done through "Microsoft graph API" itself. So closing previous response should be handled by the api itself.
If it can be done at our level , please send us more details about it.

0 Votes 0 ·

I dont have time stamp of this failure. But i was able to reproducer the same issue yesterday.

The error thrown at "2021-Mar-25 Thu 12:10:10.710"

I am not sure about what is request id mean here?

Apart from this we observe below point:
When we make above calls through AWS VMs then we are getting the above error while make same calls through Rack space VM , it gets executed successfully. And both VMs are deployed at US region only.

0 Votes 0 ·

1 Answer

VenkteshBirla-0606 avatar image
0 Votes"
VenkteshBirla-0606 answered

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.

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.