We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

bambaba12's avatar
bambaba12
Explorer | Level 4
10 months ago

ECONNRESET while downloading shared file as a stream

Hello, when I try to download a shared file using API , the socket closes at the 10th minute, and I receive an 'ECONNRESET' error. Without using the API, I was able to download for an hour. And after an hours it's closing the connection again. By the way, the file I'm downloading is over 100GB. Can you help me with this issue?

await this.httpService.axiosRef({
url: 'https://content.dropboxapi.com/2/sharing/get_shared_link_file',
method: 'POST',
headers: {
Authorization: `Bearer ${DROPBOX_API_TOKEN}`,
'Dropbox-API-Arg': JSON.stringify({ url: videoUrl }),
'Content-Type': 'application/octet-stream',
},
responseType: 'stream',
});
  • We've increased the /2/sharing/get_shared_link_file endpoint timeout. For downloads that will take a long time, please use Range requests to retrieve the entire file across multiple requests as described in my previous message.

  • Thanks for the report! It looks like the /2/sharing/get_shared_link_file endpoint is configured with a 10 minute timeout. I'll ask the team to look into whether we can increase that.

     

    As a workaround, whether you're using this /2/sharing/get_shared_link_file endpoint or are downloading from the shared link directly, you can use "Range" requests to download a portion of the file at a time.

     

    So if you need to perform these downloads over periods of time longer than the relevant timeout, please use multiple requests lasting no longer than the timeout, to download a piece of the file per request, and then re-assemble the file.

     

    For example, here's a sample of what it would look like in curl:

    curl -v -X POST https://content.dropboxapi.com/2/sharing/get_shared_link_file \
      --header 'Authorization: Bearer ACCESS_TOKEN' \
      --header 'Dropbox-API-Arg: {"url":"SHARED_LINK"}' \
      --header 'Range: bytes=0-10'

    That would download just the first 11 bytes of the file at the shared link. You can modify the byte range to download any piece of a file, such as to continue downloading the next portion of a file.

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

      We've increased the /2/sharing/get_shared_link_file endpoint timeout. For downloads that will take a long time, please use Range requests to retrieve the entire file across multiple requests as described in my previous message.

      • bambaba12's avatar
        bambaba12
        Explorer | Level 4

        Thank you. Yes, as you suggested, I started using range, and this has been more effective