Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello @Greg-DB,
We already have a Dropbox solution on production system that fetches and restore files.
Our solution uses Dropbox API SDK for .NET - https://github.com/dropbox/dropbox-sdk-dotnet
We set up 2 new Windows 2019 servers for QA Testing with our solution.
The download and upload APIs on these servers gives intermittent errors.
The upload/download speeds on these servers are about 100 Mbps.
Two days back it was giving errors, yesterday it worked and today it is again giving errors.
Upload API is giving more errors.
Can you help us know why are facing such issues on these new server ?
Which domain/IP/Port is used by the Dropbox API SDK for download and upload ?
Our error log captured the following exception stack trace for a file upload request:
Object reference not set to an instance of an object.
at Dropbox.Api.DropboxRequestHandler.GetRequestId(HttpResponseMessage response) in D:\Dropbox\Dropbox.Api\DropboxRequestHandler.cs:line 582
at Dropbox.Api.DropboxRequestHandler.<RequestJsonString>d__17.MoveNext() in D:\Dropbox\Dropbox.Api\DropboxRequestHandler.cs:line 476
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Dropbox.Api.DropboxRequestHandler.<RequestJsonStringWithRetry>d__15.MoveNext() in D:\Dropbox\Dropbox.Api\DropboxRequestHandler.cs:line 308
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Dropbox.Api.DropboxRequestHandler.<Dropbox-Api-Stone-ITransport-SendUploadRequestAsync>d__13`3.MoveNext() in D:\Dropbox\Dropbox.Api\DropboxRequestHandler.cs:line 212
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Dropbox.Business.DropboxApi.<Upload>d__53.MoveNext() in D:\Dropbox\Dropbox.Business\DropboxApi.cs:line 1703
Thanks,
Gagan
All Dropbox API calls use HTTPS, so they go to port 443 on the relevant Dropbox API servers, which, for uploading and downloading file content via the official .NET SDK, is content.dropboxapi.com.
As for the error you're getting, can you let me know what version number of the SDK you have installed, and share the relevant code snippet that's running when you see this? Thanks in advance!
All Dropbox API calls use HTTPS, so they go to port 443 on the relevant Dropbox API servers, which, for uploading and downloading file content via the official .NET SDK, is content.dropboxapi.com.
As for the error you're getting, can you let me know what version number of the SDK you have installed, and share the relevant code snippet that's running when you see this? Thanks in advance!
Thank-you for the information !
I am pasting a snippet below from AssemblyInfo.cs of Dropbox API SDK which suggest its v2 SDK.
[assembly: AssemblyTitle("Dropbox.Api")]
[assembly: AssemblyDescription("Official Dropbox .Net v2 SDK")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Dropbox Inc.")]
[assembly: AssemblyProduct("Dropbox.Api")]
[assembly: AssemblyCopyright("Copyright © Dropbox Inc")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("4.0.0")]
[assembly: AssemblyFileVersion("4.0.6562")]
I again got failure today while doing uploads on my both new QA servers.
The uploads surprisingly worked fine yesterday.
a. Our code that calls Dropbox API SDK method.
DropboxClient client = new DropboxClient(accesstoken, config);
FileMetadata fileMetadata = await client.Files.UploadAsync(remotePath, mode: WriteMode.Overwrite.Instance, autorename: false, body: stream);
b. Dropbox API SDK method stack:
- FileUserRoutes.cs
public t.Task<FileMetadata> UploadAsync(string path,
WriteMode mode = null,
bool autorename = false,
sys.DateTime? clientModified = null,
bool mute = false,
col.IEnumerable<global::Dropbox.Api.FileProperties.PropertyGroup> propertyGroups = null,
io.Stream body = null)
{
var commitInfo = new CommitInfo(path, .....
return this.UploadAsync(commitInfo, body);
}
- FileUserRoutes.cs
public t.Task<FileMetadata> UploadAsync(CommitInfo commitInfo, io.Stream body)
{
return this.Transport.SendUploadRequestAsync<CommitInfo, FileMetadata, UploadError>(commitInfo, body, "content", "/files/upload", "user", global::Dropbox.Api.Files.CommitInfo.Encoder, global::Dropbox.Api.Files.FileMetadata.Decoder, global::Dropbox.Api.Files.UploadError.Decoder);
}
- DropboxRequestHandler.cs
async Task<TResponse> ITransport.SendUploadRequestAsync<TRequest, TResponse, TError>(
TRequest request,
Stream body,
string host,
string route,
string auth,
IEncoder<TRequest> requestEncoder,
IDecoder<TResponse> resposneDecoder,
IDecoder<TError> errorDecoder)
{
..
var res = await this.RequestJsonStringWithRetry(host, route, auth, RouteStyle.Upload, serializedArg, body)
.ConfigureAwait(false);
..
..
}
- DropboxRequestHandler.cs
private async Task<Result> RequestJsonStringWithRetry(
string host,
string routeName,
string auth,
RouteStyle routeStyle,
string requestArg,
Stream body = null)
{
..
..
return await this.RequestJsonString(host, routeName, auth, routeStyle, requestArg, body)
.ConfigureAwait(false);
..
..
}
- DropboxRequestHandler.cs
private async Task<Result> RequestJsonString(
string host,
string routeName,
string auth,
RouteStyle routeStyle,
string requestArg,
Stream body = null)
{
....
....
var requestId = GetRequestId(response);
....
....
}
- DropboxRequestHandler.cs
private string GetRequestId(HttpResponseMessage response)
{
IEnumerable<string> requestId;
if (response.Headers.TryGetValues("X-Dropbox-Request-Id", out requestId))
{
return requestId.FirstOrDefault();
}
return null;
}
Thanks for the additional information. That doesn't look like the particular version information I was looking for though. Can you share the version number of the Dropbox SDK itself, e.g., as you installed via NuGet, for instance? The latest version is currently v6.6.2.
Also, looking at the stack it looks like you are not on the latest version, so I recommend upgrading to that anyway, in case this issue is already resolved in the latest version.
Anyway, I'm trying to reproduce this but I can't seem to. It works correctly for me, even after repeating the upload call many times, so please let me know if the upgrade helps.
Hello @Greg-DB
Thank-you for the information.
I upgraded the Dropbox API to v 6.6.2 and converted all my .NET projects to target .Net Framework 4.7.2.
The uploads were working fine yesterday and today morning but since last couple of hours I started getting the following exception during uploads.
The exception is thrown at this line in our Business logic code.
fileMetadata = await client.Files.UploadAsync(remotePath, mode: WriteMode.Overwrite.Instance, autorename: false, body: stream);
Please see exception stack trace below:
An error occurred while sending the request.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<RequestJsonString>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Dropbox.Api.DropboxRequestHandler.<RequestJsonStringWithRetry>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Dropbox.Api.DropboxRequestHandler.<Dropbox-Api-Stone-ITransport-SendUploadRequestAsync>d__13`3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Dropbox.Business.DropboxApi.<Upload>d__53.MoveNext() in C:\Dropbox\Business\DropboxApi.cs:line 1703
The files being uploaded were 404 KB each in size.
This might be an issue local to our server or network.
What do we need to check at our end to find if this is our local issue ?
For larger files we use UploadSessionStartAsync for file uploads.
With the new Dropbox API v6.6.2, UploadSessionStartAsync takes UploadSessionType as argument.
UploadSessionType can be Sequential, Concurrent or Other.
Which value should we choose for UploadSessionType and when ?
Can you please help us again.
Thanks,
Gagan
Thanks for upgrading and letting me know.
Can you confirm if this is the full output you're getting now though? It seems to be a different kind of issue than seen in your original post. (For instance, it no longer says "Object reference not set to an instance of an object" or the GetRequestId method.)
Anyway, since it is not occurring for me, and I don't believe we've received other reports of an issue like this, it may be related to your particular environment. Is there anything on your network connection, such as a firewall, proxy, etc. that may be interfering with your connection to content.dropboxapi.com?
Also, "Sequential" is the default for UploadSessionType, so you should be using that unless you've specifically implemented the "Concurrent" type. (The "Concurrent" type is a new feature that allows you to upload multiple pieces of a file for a particular upload session in parallel.)
Hello @Greg-DB
This is the full output and it is the same issue.
Exception in old Dropbox API version was not handled properly and control went till GetRequestID where object was null because response headers were missing. The exception message and stack trace changed after the Dropbox API was upgraded to 6.6.2.
As per your suggestion, I have asked my technical admin to check the environment.
I will let you know if we figure out any local issue.
Thanks,
Gagan
Hello @Greg-DB
The uploads worked on one of our servers but failed on 3 other servers.
The upload also worked on my local development machine.
I monitored the failed requests on the 3 servers using Fiddler and got the following in the response:
"HTTPS handshake to content.dropboxapi.com (for #18) failed. System.IO.IOException Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. < An existing connection was forcibly closed by the remote host"
I did a trace route on one of the servers where upload failed using the following command:
C:\Windows\system32>tracert content.dropboxapi.com
Tracing route to edge-block-api-env.dropbox-dns.com [162.125.11.14]
over a maximum of 30 hops:
1 11 ms 11 ms 12 ms 10.7.151.253
2 12 ms 12 ms 19 ms 107.6.3.58
3 39 ms 100 ms 13 ms et-1-1-5.tor-fr709-cor-1.peer1.net [216.187.113.177]
4 4 ms 5 ms 4 ms dropbox.ip4.torontointernetxchange.net [206.108.35.99]
5 21 ms 17 ms 20 ms po1-yyz1-ea01.net.dropbox.com [162.125.10.33]
6 12 ms 13 ms 11 ms 162.125.11.14
Trace complete.
We are checking if our hosting provider is blocking content.dropboxapi.com
Can it be possible if Dropbox is blocking requests originating from our 3 servers where uploads are failing.
If yes, how do we confirm this.
Thanks,
Gagan
The Dropbox API doesn't ban IP addresses or deny specific hosts like this. If it decides to reject a request, it would send back an error response with a specific error code, such as 429.
Given that it works on some of your machines/servers, it does sound like there's something blocking the connection on some of them. Let me know if you can't find a cause with your hosting provider though.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!