Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

mrivera's avatar
mrivera
Explorer | Level 4
5 years ago

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

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

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    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's avatar
    mrivera
    Explorer | Level 4
    5 years ago

    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 ... 

     

     

  • mrivera's avatar
    mrivera
    Explorer | Level 4
    5 years ago

    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 ... 

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    5 years ago

    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's avatar
    mrivera
    Explorer | Level 4
    5 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    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's avatar
    mrivera
    Explorer | Level 4
    5 years ago

    Hi Greg-DB

    Many thanks for your insights. They are very appreciated. 

    Thanks and bye ... 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

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!