Jericho / ZoomNet

.NET client library for the Zoom.us REST API v2
MIT License
69 stars 45 forks source link

Large recording download exception #295

Closed Bob-HL closed 1 year ago

Bob-HL commented 1 year ago

When call:

var stream = await iZoomClient.CloudRecordings.DownloadFileAsync(downloadUrl);

Small files are OK. If the file size is larger than 400MB also, error occur:

An unhandled exception has occurred while executing the request. ZoomNet.Utilities.ZoomException: 589: at ZoomNet.Utilities.ZoomErrorHandler.OnResponse(IResponse response, Boolean httpErrorAsException) at Pathoschild.Http.Client.Internal.Request.Execute() at Pathoschild.Http.Client.Internal.Request.AsStream()

Any suggestion is appreciated.

Jericho commented 1 year ago

Unhandled exception has occurred is quite vague and doesn't help me diagnose what the problem might be. However, since you mention that this problem occurs only when the file is large, I'm going to guess that this exception is a timeout resulting from the fact that it takes a long time to download.

About a year ago, I made a minor (but rather important) improvement to ZoomNet to more efficiently handle large files (see #201) therefore my first suggestion is that you should make sure you are using the latest version and not an old and inefficient version of ZoomNet.

Secondly, you can increase the timeout (which is 90 seconds by default if I'm not mistaken) to allow the HTTP client enough time to download your file before giving up and throwing an exception. See this relevant discussion and in particular this comment where I show C# code sample to increase the timeout.

Jericho commented 1 year ago

Also, have you considered catching the exception and looking at the ZoomException object? It contains properties such as DiagnosticLog, ErrorCode and StatusCode which may offer more detailed info about the problem.

Bob-HL commented 1 year ago

Thanks for prompt response with the details. The DiagnosticLog below doesn't show that it is a timeout error. But your suggestion to pass HttpClient with TimeOut longer than 90 seconds solve the problem. Thanks.

REQUEST: GET https://us06web.zoom.us/rec/download/xx927... Accept: application/json Authorization: ...redacted for security reasons... ZoomNet-Diagnostic-Id: b34b6661fa2543dbb1fd235031ed4b16 Content-Length: 0

RESPONSE: HTTP/1.1 589

DIAGNOSTIC: The request took 1 minute 40 seconds 579 milliseconds