I hope that someone can help me better than on github.
opened 12:21PM - 29 Mar 22 UTC
### Describe the problem
When uploading a record set of 2451 items of 499834 b… ytes to `client.Jobs.ImportUsersAsync` there is an exception in reading the response. `Cannot access a closed Stream.`
It might be valueable to know that we insert more than 1 job in a short time. We have around 7000 records and we need them in Auth0. Our process splits them in batches to not exceed the upload max.
I've also tried lowering the bytes send greatly but it also fails. Also we delay 2 seconds after each call
### What was the expected behavior?
Return an processable error and not an exception
### Stacktrace
The only thing I can share is this;
```
System.Net.Http.HttpRequestException: Error while copying content to a stream.
---> System.ObjectDisposedException: Cannot access a closed Stream.
at System.IO.MemoryStream.CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
at System.IO.Stream.CopyToAsync(Stream destination, CancellationToken cancellationToken)
at System.Net.Http.StreamToStreamCopy.CopyAsync(Stream source, Stream destination, Int32 bufferSize, Boolean disposeSource, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
--- End of inner exception stack trace ---
at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
at System.Net.Http.MultipartContent.SerializeToStreamAsyncCore(Stream stream, TransportContext context, CancellationToken cancellationToken)
at System.Net.Http.HttpContent.<CopyToAsync>g__WaitAsync|56_0(ValueTask copyTask)
at System.Net.Http.HttpConnection.SendRequestContentAsync(HttpRequestMessage request, HttpContentWriteStream stream, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Auth0.ManagementApi.HttpClientManagementConnection.SendRequest[T](HttpRequestMessage request, JsonConverter[] converters, CancellationToken cancellationToken)
at Auth0.ManagementApi.HttpClientManagementConnection.SendAsyncInternal[T](HttpMethod method, Uri uri, Object body, IDictionary`2 headers, IList`1 files, JsonConverter[] converters, CancellationToken cancellationToken)
at Auth0.ManagementApi.HttpClientManagementConnection.<>c__DisplayClass14_0`1.<<SendAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Auth0.ManagementApi.HttpClientManagementConnection.Retry[TResult](Func`1 retryable)
at Auth0.ManagementApi.HttpClientManagementConnection.SendAsync[T](HttpMethod method, Uri uri, Object body, IDictionary`2 headers, IList`1 files, JsonConverter[] converters, CancellationToken cancellationToken)
```
When uploading a record set of 2451 items of 499834 bytes to client.Jobs.ImportUsersAsync
there is an exception in reading the response. Cannot access a closed Stream.
It might be valueable to know that we insert more than 1 job in a short time. We have around 7000 records and we need them in Auth0. Our process splits them in batches to not exceed the upload max.
I’ve also tried lowering the bytes send greatly but it also fails. Also we delay 2 seconds after each call