cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: dropboxjs longpoll : error 400 : You must issue the request to "notify.dropboxapi.com"

dropboxjs longpoll : error 400 : You must issue the request to "notify.dropboxapi.com"

Romain B.2
New member | Level 2
Go to solution

Hi,

When I'm calling the filesListFolderLongpoll() method I get the following error:

status: 400,
text: 'Incorrect host for API function "files/list_folder/longpoll". You must issue the request to "notify.dropboxapi.com".'

I'm getting a cursor with filesListFolderGetLatestCursor() and then I give the cursor I just retrieved to filesListFolderLongpoll().

Here is a sample code:

var Dropbox = require('dropbox');
var dbx = new Dropbox({accessToken: 'MY_ACCESS_TOKEN_HERE'});
dbx.filesListFolderGetLatestCursor({path: '',
        recursive: false,
        include_media_info: false,
        include_deleted: false,
        include_has_explicit_shared_members: false
    })
    .then((last_cursor) => {
        dropboxLongpoll(last_cursor.cursor);
    })
    .catch((err) => {
        console.log(error);
    });

function dropboxLongpoll(last_cursor) {
    dbx.filesListFolderLongpoll({cursor: last_cursor, timeout: 30})
        .then((result) => {
            console.log(result);
            
            // [ ... do stuff ...]
        })
        .catch((err) => {
            console.log(err);
        });
}

I'm using Dropbox javascript SDK in version 2.3.0.

Did I make any mistakes ?

Thank you!

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

Thanks Romain! The team is also working on a fix here:

https://github.com/dropbox/dropbox-sdk-js/pull/79

View solution in original post

6 Replies 6

Rich
Super User II
Go to solution

Moved to the API forum.

Greg-DB
Dropbox Staff
Go to solution

Thanks for the report! This looks like an issue in the library itself, not how you're using it. We're looking into it.

Romain B.2
New member | Level 2
Go to solution

Thank you!

Romain B.2
New member | Level 2
Go to solution

I have got a quick and dirty fix, but I'm not to sure of the impact it has. I can submit it if necessary.

The BASE_URL variable in rpc-requests.js is set to 'https://api.dropboxapi.com/2/', so no request can be sent to https://notify.dropboxapi.com/2/.

In the DropboxBase.prototype.request (dropbox-base.js) method, the 'host' parameter is not used. This parameter is properly set to 'notify' when a call to filesListFolderLongpoll() occurs but it is not given to rpcRequest. And, as I said above, BASE_URL is hard coded.

Hope this can help :slightly_smiling_face:

Greg-DB
Dropbox Staff
Go to solution

Thanks Romain! The team is also working on a fix here:

https://github.com/dropbox/dropbox-sdk-js/pull/79

Romain B.2
New member | Level 2
Go to solution

Great, thanks!

Need more support?