Forum Discussion

mepard's avatar
mepard
New member | Level 2
4 years ago

504 Gateway Timeout listing files in 2 accounts with code that had been working

On 5-Jan-2022 just after 3:00 CST, notify.dropboxapi.com/2/files/list_folder/longpoll quit returning any changes or api.dropboxapi.com/2/files/list_folder/continue quit returning any files (could be either).

 

I restarted the process, but it didn't help.

 

Thinking it might be a cursor problem, I started over with api.dropboxapi.com/2/files/list_folder to generate a new cursor.
At that point it started getting HTTP/1.1 504 Gateway Timeout.

 

Following the advice at https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/list-folder-continue-gt-504-errors/td-p/299023, I kept reducing the limit value and am down to 25 and still getting 504s.

 

This happens on two different Dropbox app tokens with differing numbers of files. The code has been working well on the same accounts for over a year.

 

Here are two examples:

Request: POST /2/files/list_folder HTTP/1.1
Host: api.dropboxapi.com
Authorization: Bearer <app token 1>
User-Agent: MATLAB/9.11.0.1809720 (R2021b) Update 1
Content-Type: application/json
Date: Fri, 07 Jan 2022 14:51:02 GMT
Content-Length: 188
Accept-Encoding: gzip
Accept: application/json
CharacterEncoding: ISO-8859-1
Expect: 100-continue
<< 188 bytes of application/json data >>

Response: HTTP/1.1 504 Gateway Timeout
Content-Type: text/html
Date: Fri, 07 Jan 2022 14:52:32 GMT
Server: envoy
Content-Encoding: gzip
Vary: Accept-Encoding
X-Dropbox-Response-Origin: far_remote
X-Dropbox-Request-Id: 50395fe1c7384de8accf3ddb584afb7b
Transfer-Encoding: chunked
[Content elided]


Request: POST /2/files/list_folder/continue HTTP/1.1
Host: api.dropboxapi.com
Authorization: Bearer <app token 2>
User-Agent: MATLAB/9.11.0.1809720 (R2021b) Update 1
Content-Type: application/json
Date: Fri, 07 Jan 2022 12:47:36 GMT
Content-Length: 251
Accept-Encoding: gzip
Accept: application/json
CharacterEncoding: ISO-8859-1
Expect: 100-continue
{"cursor":"AAHgy8cta3wWMzglPU33cOUTBH6QUWanBmHxSJHaye0aQk3AtR-NO5lQ7SKlJ_CPXJ3-mboxosbq_azt_pjIXarl8n2T8GgPW1dg0uGoX2tkTK6lYklmcj19b1B8DFSE2YidTSD2LZtm2z3wiRKPIR61EnVbSsogWpzCkMtX0JRR34lF3EJD-BDZiv5_1jX-sKK5JE4vL4ZwBXS6LLNzH8CEFnHE-8r6V_eSxztenMoBNw"}

Response: HTTP/1.1 504 Gateway Timeout
Content-Type: text/html
Date: Fri, 07 Jan 2022 12:49:07 GMT
Server: envoy
Content-Encoding: gzip
Vary: Accept-Encoding
X-Dropbox-Response-Origin: far_remote
X-Dropbox-Request-Id: d4082e3cf5594d3fb6b323a695633182
Transfer-Encoding: chunked
[Content elided]

3 Replies

  • mepard's avatar
    mepard
    New member | Level 2
    4 years ago

    It turns out the first problem (no files listed) might be on the other end. The devices doing the uploads stopped succeeding yesterday afternoon. I'll try to find out what errors they were getting.

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

    Thanks for the report! Like in the other thread you linked to, this 504 error can be related to these operations taking a long time due to a large number of files and/or a large amount of file activity in the affected account(s). That can vary over time due to account activity and other such factors though. We'll look into it.

     

    You may be able to workaround this issue by setting recursive=false on /2/files/list_folder so I recommend giving that a try (though that may require updating your implementation accordingly).

  • mepard's avatar
    mepard
    New member | Level 2
    4 years ago

    Turns out a subtle but reasonable change to Dropbox upload responses uncovered a bug in our prototype devices. That caused the lack of listed files and also caused a lot of retries, which probably triggered the 504s when I dumped the cursors and restarted the listing. I resurrected the cursors and listings work now. Thanks for investigating.

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!