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

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

too_many_requests when uploading multiple files

Hello,

 

I am using the javascript sdk and using dbx.filesUpload multiple times to upload multiple files, but I am getting too many requests error. How can I upload multiple files without running in to this error? Below is my error:

{
  error: {
    error_summary: 'too_many_requests/..',
    error: { reason: [Object], retry_after: 15 }
  },
  response: Body {
    url: 'https://content.dropboxapi.com/2/files/upload',
    status: 429,
    statusText: 'Too Many Requests',
    headers: Headers { _headers: [Object] },
    ok: false,
    body: PassThrough {
      _readableState: [ReadableState],
      readable: false,
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      _writableState: [WritableState],
      writable: false,
      allowHalfOpen: true,
      _transformState: [Object],
      [Symbol(kCapture)]: false
    },
    bodyUsed: true,
    size: 0,
    timeout: 0,
    _raw: [
      <Buffer 7b 22 65 72 72 6f 72 5f 73 75 6d 6d 61 72 79 22 3a 20 22 74 6f 6f 5f 6d 61 6e 79 5f 72 65 71 75 65 73 74 73 2f 2e 2e 22 2c 20 22 65 72 72 6f 72 22 3a ... 62 more bytes>
    ],
    _abort: false,
    _bytes: 112
  },
  status: 429
}

 Thanks

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Attempting to upload multiple files at the same time can cause issues like this. Please refer to the Performance Guide for information on how to manage this.

    • Beatso's avatar
      Beatso
      Explorer | Level 4

      Thanks for the reply. Does that mean there is no way to upload multiple (it's only 5, very small files) at once without getting caught by the ratelimit? Would I have to, for example, upload one file every second? If so, how would I do that?

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        That's correct, the Dropbox API doesn't offer a way to upload multiple files in one call, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though. 

         

        That being the case, you will need to loop through your files and call filesUpload once per file, but only call filesUpload for the next file once the previous file upload has completed, that is, once the callback method has fired.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,915 PostsLatest Activity: 3 hours ago
333 Following

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