You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Ridvan_
3 years agoHelpful | Level 6
Re: Dropbox v2 api. Javascript app installed in Windows Server behind proxy
I have a node.js app which runs on AWS Lambda. The Lambda is connected with a VPC. It goes internet with a static IP. I use v10.23.0 dropbox-sdk-js. It always seems to run on my local but it sometimes runs on the lambda, sometimes gets fetch error.
My code is like this:
async function main() { const Dropbox = require('dropbox').Dropbox; const dropbox = { dbx: new Dropbox({ accessToken: process.env.ACCESS_TOKEN, pathRoot: JSON.stringify({ '.tag': 'namespace_id', 'namespace_id': process.env.NAMESPACE_ID }) }) }; const payload = { path: '', recursive: true, include_media_info: false, include_deleted: false, include_has_explicit_shared_members: true, include_mounted_folders: true, include_non_downloadable_files: true }; let hasMore = true; let entries = []; let response; let cursor; while (hasMore) { try { if (cursor) { response = await dropbox.dbx.filesListFolderContinue({ cursor: cursor }); } else { response = await dropbox.dbx.filesListFolderGetLatestCursor(payload); response = await dropbox.dbx.filesListFolderContinue({ cursor: response.result.cursor }); } console.info('Entries: ', JSON.stringify(response.result.entries)); cursor = response.result.cursor; entries = entries.concat(response.result.entries); hasMore = response.result.has_more; } catch (error) { console.info(error); return error; } } } main();
Error log:
2022-01-20T08:22:18.579Z 67caa239-e75c-46ce-be4c-0fcf6c154694 INFO FetchError: request to https://api.dropboxapi.com/2/files/list_folder/continue failed, reason: connect ETIMEDOUT 162.125.4.19:443 at ClientRequest.<anonymous> (/var/task/node_modules/dropbox/node_modules/node-fetch/lib/index.js:1483:11) at ClientRequest.emit (events.js:400:28) at TLSSocket.socketErrorListener (_http_client.js:475:9) at TLSSocket.emit (events.js:400:28) at emitErrorNT (internal/streams/destroy.js:106:8) at emitErrorCloseNT (internal/streams/destroy.js:74:3) at processTicksAndRejections (internal/process/task_queues.js:82:21) { type: 'system', errno: 'ETIMEDOUT', code: 'ETIMEDOUT' }
Do you have any idea about the issue?
Greg-DB I found the problem. An AWS Lambda that is attached to a VPC, causes FetchError problem. I deattached the lambda from VPC. It works fine now. By the way, thanks for your advices.
- Greg-DBDropbox Staff
Ridvan_ You originally posted this in a thread where this issue seemed to be related to the use of a proxy. It sounds like that's not relevant in your case though, so I've split your post to its own thread.
Anyway, I see you're getting an ETIMEDOUT error from the fetch network client. An ETIMEDOUT error like this should indicate that the connection took too long and so timed out, though unfortunately there isn't much indication of why that is the case here. For reference, do you only see this on /2/files/list_folder/continue in particular, or does it occur on other endpoints as well?
Also, you mentioned that you see this "sometimes". Can you elaborate on how often you see this, and on about what percent of your API calls? If it only occurs occasionally, it may just be due to transient network disruptions or server availability issues, in which case you could add some automatic retries to handle this.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf 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 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!