cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Dropbox v2 api. Javascript app installed in Windows Server behind proxy

Dropbox v2 api. Javascript app installed in Windows Server behind proxy

mrivera
Explorer | Level 4

Hi all, 

 

I have this app which was built in Javascript (Meteor). Basically, the user saves some Word documents in Dropbox, using the DB web interfase. Then, users use the app to pass some data to build documents. The app needs to: 

 

1) connect to DropBox to get the list of Word files in a folder 

2) read the document (from DropBox) that the user selects to build the document from there 

 

So the problem is: the app can't connect to DB to get the list of files in a folder, apparently, because the server (Windows) is in a network which is behind a proxy. This is the error message the app receives: 

 

FetchError: request to https://api.dropboxapi.com/2/files/list_folder failed, reason: connect ETIMEDOUT 162.125.5.19:443

 

A similar situation ocurred when I had to install the app from GitHub. Clonning the app from GitHub didn't work until I saved the proxy settings in the config file. Then, the app was installed from GitHub pretty fine. Then config settings to establish proxy info for git to work are: 

 

[http]
proxy = http://siste02:<pwd here>@192.168.0.111:3128
[https]
proxy = http://siste02:<pwd here>.@192.168.0.111:3128

So, my question is: what do I need to do so that my app connects succesfully to DropBox in a case like this? 

 

Note that this app connects to DropBox perfectly fine in many others installations, which are similar like this one but with *no* proxy installed in the network. 

 

Many thanks and bye ... 

8 Replies 8

Greg-DB
Dropbox Staff

Are you using the official Dropbox API v2 JavaScript SDK? That doesn't offer an option for specifying a proxy unfortunately, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. 

 

If you're not using that SDK and are instead using some other library or client, you may be able to configure it to use a proxy, but we can't offer support for third party libraries/clients, so I'm afraid I can't offer guidance on that. You would need to refer to the documentation for that library/client.

mrivera
Explorer | Level 4

Hi Greg-DB, thanks for your answer. 

Yes, I'm using official DB v2 API JS SDK. In fact, this is a sample of my code, just to retrieve a list of files from a DropBox folder: 

 

... 
import { Dropbox } from 'dropbox';
import fetch from 'isomorphic-fetch';
...

try {
const dbx = new Dropbox({ accessToken, fetch });

const files0 = await dbx.filesListFolder({ path: folderPath });
const files1 = files0.entries.filter(x => x[".tag"] === "file").map(x => ({ name: x.name }));

files = lodash.orderBy(files1, ['name'], ['asc']);

} catch (err) {
... 
}

 

So, you are telling me that I just can't run my code if the server is behind a proxy. Do I have other options? Maybe some path to research? I just have invested lots of my time developing this app and it is just running in a (Windows) server that is in a network which happens to be behind a proxy. 

 

Many thanks ... 

 

 

Greg-DB
Dropbox Staff

The official Dropbox API v2 JavaScript SDK unfortunately doesn't have a way to specify a proxy. It is open source though, so you could fork and modify it as needed. For instance, it looks like isomorphic-fetch allows you to supply a proxy via an 'agent' option. You may want to try modifying the SDK to allow you to set that option, e.g., in the locations where the options are defined in the SDK here.

mrivera
Explorer | Level 4

Hi and thanks, 

Does the api works through an specific address? 

Can I ask the network admin people to open some IP or Port or both? 

 

I mean, can I configure (or ask the appropiate person) the proxy to allow making such calls? 

 

For example, the error message I get when trying the API call is this: 

 

FetchError: request to https://api.dropboxapi.com/2/files/list_folder failed, reason: connect ETIMEDOUT 162.125.5.19:443

 

So, there can be some way to config the proxy so those api calls go through? 

 

Many thanks ... 

Здравко
Legendary | Level 20

@mrivera wrote:

...

Does the api works through an specific address? 

...

Hi @mrivera,

While the words are going on about network API, there is always some kind of address (either domain name or IP). In particular case addresses are pointed by domain names.

 


@mrivera wrote:
...

Can I ask the network admin people to open some IP or Port or both? 

 

I mean, can I configure (or ask the appropiate person) the proxy to allow making such calls? 

... 


🤔 Does your proxy restrict you to make external connection? If there is some firewall and the settings are restrictive for external connections (for some reason, which is something unusual), then you should ask for access. Are you restricted to access Dropbox site on the particular machine? If not, most likely you don't have to do anything. 😉

 


@mrivera wrote:
...

FetchError: request to https://api.dropboxapi.com/2/files/list_folder failed, reason: connect ETIMEDOUT 162.125.5.19:443

 

So, there can be some way to config the proxy so those api calls go through? 

... 


🙂 Don't think for "way to config the proxy"! On first place you should think for way to connect to the proxy. The error, you get, shows 2 things: the application successfully resolve the domain name to IP (i.e. your DNS works) and outbound connections are restricted when skipping proxy (something expected). The pointed IP and port here (something which confuses you most probably) represent address of target Dropbox server. That is NOT your machine/network address or port! 😉 Again, if your firewall (if any) doesn't restrict access to this address (most likely), you shouldn't worry about this address and the proxy config. The only thing you have to do is, as @Greg-DB mentioned, make the proxy connection possible, either yourself or wait for new SDK release dealing with this. That's it.

Hope this clarifies matter.

mrivera
Explorer | Level 4

Hi (again), 

I was just watching this reply in an Stack Overflow thread: 

 

def get_my_proxy():
    """ Static method to get proxy
    """
    proxy = '134.245.32.30:80'
    http_proxy = "http://" + proxy
    https_proxy = "https://" + proxy
    ftp_proxy = "ftp://" + proxy

    proxyDict = {
        "http": http_proxy,
        "https": https_proxy,
        "ftp": ftp_proxy
    }
    return proxyDict

import dropbox
access_token = 'myawesomeaccesstoken'
mysesh = dropbox.create_session(1,get_my_proxy())
dbx = dropbox.Dropbox(access_token,session=mysesh)

# Test the connection
dbx.users_get_current_account()

I was wondering ... isn't something like this what I am after, *but* in JavaScript, not Python?? 

 

Why is this possible in Python and not in JS? 

 

Many thanks for your help ... 

Greg-DB
Dropbox Staff

@mrivera The API v2 Python and JavaScript SDKs are different code bases and may offer different features like this. I can't offer insight on why one may have something like this implemented and the other doesn't, but I've sent this along as a feature request.

mrivera
Explorer | Level 4

Hi @Greg-DB

Many thanks for your insights. They are very appreciated. 

Thanks and bye ... 

Need more support?