cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you using the Microsoft co-authoring beta for Dropbox? Share your feedback and learn more about it 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: 

Bad gateway Error

Bad gateway Error

hbtest
New member | Level 1

I'm using CPP Rest SDK (https://casablanca.codeplex.com/)

I'm trying to use chunked upload feature and it's always 502 Error: Bad gateway in response.

My actions:

1) I do initial request to /2/files/upload_session/start with empty body just to obtain session_id

2) I do request to /2/files/upload_session/append using session_id I've got on previous step with chuck of file as body

In response for last request I got this error.

8 Replies 8

Greg-DB
Dropbox Staff

How big is the chunk you're sending in step 2?

hbtest
New member | Level 1

It's 1MB.

Greg-DB
Dropbox Staff

Thanks! That's a relatively small chunk size, so that should be fine. How long does that call take before it fails though? 

Can you share the relevant code snippets and full response?

hbtest
New member | Level 1

Sorry for delay, here it is:

http_client APIclient(L"https://content.dropboxapi.com/");

http_request upldrq(methods::POST);

upldrq.set_request_uri(L"/2/files/upload_session/append");

upldrq.headers().add(http::header_names::authorization, L"Bearer " + m_password);

upldrq.headers().add(http::header_names::content_type, L"application/octet-stream");

upldrq.headers().add(L"Dropbox-API-Arg", L"{\"session_id\": " + m_upload_session_id + L",\"offset\": " + std::to_wstring(m_upload_offset));

upldrq.set_body(*m_data, m_buffer_sz);

APIclient.request(upldrq).then([&](http_response response)
{
   statuscode = response.status_code();

   if (statuscode != 200)
   {
      wstring err = response.extract_string().get();
   }

}).wait();

hbtest
New member | Level 1

And full response:

<!DOCTYPE html>
<html>
<head><title>Dropbox - 5xx</title>
<link href="//www.dropbox.com/static/css/error.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="//www.dropbox.com/static/images/favicon.ico"/>
</head>
<body>
<div class="figure">
<img src="//www.dropbox.com/static/images/sickbox.png" alt="Error: 5xx"/>
</div>
<div id="errorbox">
<h1>Error (5xx)</h1>Something went wrong. Don't worry, your files are still safe and the Dropboxers have been notified. Check out our <a href="https://www.dropbox.com/help">Help Center</a> and <a href="https://forums.dropbox.com">forums</a> for help, or head back to <a href="https://www.dropbox.com/home">home</a>.
</div>

<script type="text/javascript" src="//www.dropbox.com/static/javascript/compiled/external/prototype.js"></script>
<script>
message = {"ru": "\u003ch1\u003e\u041e\u0448\u0438\u0431\u043a\u0430 (5xx)\u003c/h1\u003e\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u041d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u0442\u0435\u0441\u044c, \u0432\u0430\u0448\u0438 \u0444\u0430\u0439\u043b\u044b \u043d\u0435 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u043b\u0438, \u0430 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0438 Dropbox \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435. \u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u003ca href=\"https://www.dropbox.com/help\"\u003e\u0441\u043f\u0440\u0430\u0432\u043e\u0447\u043d\u044b\u0439 \u0446\u0435\u043d\u0442\u0440\u003c/a\u003e \u0438\u043b\u0438 \u043d\u0430 \u003ca href=\"https://forums.dropbox.com\"\u003e\u0444\u043e\u0440\u0443\u043c\u044b\u003c/a\u003e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u043b\u0438 \u0432\u0435\u0440\u043d\u0438\u0442\u0435\u0441\u044c \u043d\u0430 \u003ca href=\"https://www.dropbox.com/home\"\u003e\u0434\u043e\u043c\u0430\u0448\u043d\u044e\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443\u003c/a\u003e.", "fr": "\u003ch1\u003eErreur (5xx)\u003c/h1\u003eUn probl\u00e8me est survenu. Ne vous inqui\u00e9tez pas, vos fichiers sont toujours en s\u00e9curit\u00e9 et les Dropboxeurs ont \u00e9t\u00e9 avertis. Consultez notre \u003ca href=\"https://www.dropbox.com/help\"\u003ecentre d'assistance\u003c/a\u003e et nos \u003ca href=\"https://forums.dropbox.com\"\u003eforums\u003c/a\u003e pour obtenir de l'aide, ou retournez sur la page d'\u003ca href=\"https://www.dropbox.com/home\"\u003eaccueil\u003c/a\u003e.", "nb_NO": "\u003ch1\u003eFeilmelding (5xx)\u003c/h1\u003eNoe gikk galt. Ikke bekymre deg, filene dine er trygge og Dropbox er varslet. Sjekk ut v\u00e5rt \u003ca href=\"https://www.dropbox.com/help\"\u003ehjelpesenter\u003c/a\u003e og \u003ca href=\"https://forums.dropbox.com\"\u003efora\u003c/a\u003e for hjelp, eller g\u00e5 tilbake til \u003ca href=\"https://www.dropbox.com/home\"\u003ehjemmesiden\u003c/a\u003e.", "zh_TW": "\u003ch1\u003e\u932f\u8aa4 (5xx)\u003c/h1\u003e\u767c\u751f\u932f\u8aa4\u3002\u5225\u64d4\u5fc3\uff0c\u60a8\u7684\u6a94\u6848\u5b89\u5168\u7121\u865e\uff0c\u5df2\u901a\u77e5 Dropbox \u54e1\u5de5\u3002\u8acb\u5230\u6211\u5011\u7684\u003ca href=\"https://www.dropbox.com/help\"\u003e\u8aaa\u660e\u4e2d\u5fc3\u003c/a\u003e\u548c\u003ca href=\"https://forums.dropbox.com\"\u003e\u8a0e\u8ad6\u5340\u003c/a\u003e\u53d6\u5f97\u5354\u52a9\uff0c\u62... href=\"https://www.dropbox.com/home\"\u003e\u9996\u9801\u003c/a\u003e\u3002", "pt_BR": "\u003ch1\u003eErro ( 5xx ).\u003c/h1\u003eDeu algo errado, mas n\u00e3o se preocupe. Os seus arquivos permanecem em seguran\u00e7a, e a equipe do Dropbox j\u00e1 foi notificada. Confira nossa \u003ca href=\"https://www.dropbox.com/help\"\u003eCentral de ajuda\u003c/a\u003e e \u003ca href=\"https://forums.dropbox.com\"\u003enossos f\u00f3runs\u003c/a\u003e para obter ajuda ou volte para a \u003ca href=\"https://www.dropbox.com/home\"\u003ep\u00e1gina inicial\u003c/a\u003e.", "zh_CN": "\u003ch1\u003e\u9519\u8bef (5xx)\u003c/h1\u003e \u51fa\u73b0\u95ee\u9898\u3002\u522b\u62c5\u5fc3\uff0c\u60a8\u7684\u6587\u4ef6\u4ecd\u5b89\u5168\uff0c\u800c\u4e14 Dropbox \u5458\u5de5\u5df2\u6536\u5230\u901a\u77e5\u3002\u8bf7\u67e5\u9605\u6211\u4eec\u7684\u003ca href=\"https://www.dropbox.com/help\"\u003e\u5e2e\u52a9\u4e2d\u5fc3\u003c/a\u003e\u548c \u003ca href=\"https://forums.dropbox.com\"\u003e\u8bba\u575b\u003c/a\u003e\u83b7\u53d6\u5e2e\u52a9\uff0c\u6216\u8f... \u003ca href=\"https://www.dropbox.com/home\"\u003e\u4e3b\u9875\u003c/a\u003e\u3002", "da_DK": "\u003ch1\u003eFejl (5xx)\u003c/h1\u003e Noget gik galt. Men ingen grund til bekymring, dine filer er sikre, og Dropboxerne har f\u00e5et besked. Tjek vores \u003ca href=\"https://www.dropbox.com/help\"\u003eHj\u00e6lpecenter\u003c/a\u003e og \u003ca href=\"https://forums.dropbox.com\"\u003eforummer\u003c/a\u003e for hj\u00e6lp, eller g\u00e5 tilbage til \u003ca href=\"https://www.dropbox.com/home\"\u003estart\u003c/a\u003e.", "de": "\u003ch1\u003eFehler (5xx)\u003c/h1\u003eEtwas ist schiefgelaufen. Ihre Dateien sind aber immer noch sicher und Dropbox wurde benachrichtigt. Schauen Sie sich im \u003ca href=\"https://www.dropbox.com/help\"\u003eHilfecenter\u003c/a\u003e und in den \u003ca href=\"https://forums.dropbox.com\"\u003eForen\u003c/a\u003e um, wenn Sie Hilfe ben\u00f6tigen, oder kehren Sie zur\u00fcck auf die \u003ca href=\"https://www.dropbox.com/home\"\u003eStartseite\u003c/a\u003e.", "ko": "\u003ch1\u003e\uc624\ub958(5xx)\u003c/h1\u003e\ubb38\uc81c\uac00 \ubc1c\uc0dd\ud588\uc2b5\ub2c8\ub2e4. \ud30c\uc77c\uc740 \uc548\uc804\ud558\uac8c \ubcf4\uad00\ub418\uc5b4 \uc788\uc73c\ub2c8 \uc548\uc2ec\ud558\uc138\uc694. \uc774 \ubb38\uc81c\ub294 Dropbox \ub2f4\ub2f9\uc790\uc5d0\uac8c \uc804\ub2ec\ub418\uc5c8\uc73c\uba70, \ub3c4\uc6c0\uc774 \ud544\uc694\ud55c \uacbd\uc6b0 Dropbox\uc758 \u003ca href=\"https://www.dropbox.com/help\"\u003e\ub3c4\uc6c0\ub9d0 \uc13c\ud130\u003c/a\u003e \ubc0f \u003ca href=\"https://forums.dropbox.com\"\u003e\ud3ec\ub7fc\u003c/a\u003e\uc744 \ucc38\uc870\ud558\uac70\ub098 \u003ca href=\"https://www.dropbox.com/home\"\u003e\ud648\u003c/a\u003e\uc73c\ub85c \ub3cc\uc544\uac00\uc138\uc694.", "it": "\u003ch1\u003eErrore (5xx)\u003c/h1\u003eQualcosa \u00e8 andato storto. Non ti preoccupare i tuoi file sono comunque al sicuro e i Dropboxer sono stati notificati. Consulta il \u003ca href=\"https://www.dropbox.com/help\"\u003eCentro assistenza\u003c/a\u003e e \u003ca href=\"https://forums.dropbox.com\"\u003ei forum\u003c/a\u003e per assistenza oppure torna alla \u003ca href=\"https://www.dropbox.com/home\"\u003ehomepage\u003c/a\u003e.", "sv_SE": "\u003ch1\u003eFel (5xx)\u003c/h1\u003e N\u00e5got gick fel. Oroa dig inte. Dina filer \u00e4r fortfarande s\u00e4kra och Dropboxare har meddelats. Kolla in v\u00e5rt \u003ca href=\"https://www.dropbox.com/help\"\u003eHj\u00e4lpcenter\u003c/a\u003e och \u003ca href=\"https://forums.dropbox.com\"\u003ev\u00e5ra forum\u003c/a\u003e f\u00f6r att f\u00e5 hj\u00e4lp eller g\u00e5 tillbaka till \u003ca href=\"https://www.dropbox.com/home\"\u003estartsidan.\u003c/a\u003e", "uk_UA": "\u003ch1\u003e\u041f\u043e\u043c\u0438\u043b\u043a\u0430 (5xx)\u003c/h1\u003e\u0429\u043e\u0441\u044c \u043f\u0456\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a. \u041d\u0435 \u0445\u0432\u0438\u043b\u044e\u0439\u0442\u0435\u0441\u044f, \u0432\u0430\u0448\u0456 \u0444\u0430\u0439\u043b\u0438 \u0432 \u0431\u0435\u0437\u043f\u0435\u0446\u0456, \u0430 \u043f\u0440\u0430\u0446\u0456\u0432\u043d\u0438\u043a\u0438 Dropbox \u0443\u0436\u0435 \u0432 \u043a\u0443\u0440\u0441\u0456 \u043f\u043e\u0434\u0456\u0439. \u041f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u044c\u0442\u0435 \u003ca href=\"https://www.dropbox.com/help\"\u003e\u0426\u0435\u043d\u0442\u0440 \u0434\u043e\u0432\u0456\u0434\u043a\u0438\u003c/a\u003e \u0442\u0430 \u003ca href=\"https://forums.dropbox.com\"\u003e\u0444\u043e\u0440\u0443\u043c\u0438\u003c/a\u003e \u0430\u0431\u043e \u043f\u043e\u0432\u0435\u0440\u043d\u0456\u0442\u044c\u0441\u044f \u043d\u0430 \u003ca href=\"https://www.dropbox.com/home\"\u003e\u0433\u043e\u043b\u043e\u0432\u043d\u0443 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0443\u003c/a\u003e.", "nl_NL": "\u003ch1\u003eFout (5xx).\u003c/h1\u003eEr is iets fout gegaan. Maak je geen zorgen, je bestanden zijn veilig en de Dropboxers zijn op de hoogte gesteld. Kijk in ons \u003ca href=\"https://www.dropbox.com/help\"\u003ehelpcentrum\u003c/a\u003e en de \u003ca href=\"https://forums.dropbox.com\"\u003eforums\u003c/a\u003e voor hulp of ga terug naar de \u003ca href=\"https://www.dropbox.com/home\"\u003ebeginpagina\u003c/a\u003e.", "es": "\u003ch1\u003eError (5xx).\u003c/h1\u003e Ocurri\u00f3 un problema. No te preocupes, tus archivos est\u00e1n seguros y los empleados de Dropbox recibieron un aviso. Visita el \u003ca href=\"https://www.dropbox.com/help\"\u003eCentro de ayuda\u003c/a\u003e y los \u003ca href=\"https://forums.dropbox.com\"\u003eforos\u003c/a\u003e para obtener ayuda, o bien vuelve a la \u003ca href=\"https://www.dropbox.com/home\"\u003ep\u00e1gina principal\u003c/a\u003e.", "ms": "\u003ch1\u003eRalat (5xx)\u003c/h1\u003eAda sesuatu yang tidak kena. Jangan risau, fail anda masih selamat dan Dropboxer telah dimaklumkan. Lihat \u003ca href=\"https://www.dropbox.com/help\"\u003ePusat Bantuan\u003c/a\u003e dan \u003ca href=\"https://forums.dropbox.com\"\u003eforum\u003c/a\u003e kami untuk bantuan, atau kembali ke \u003ca href=\"https://www.dropbox.com/home\"\u003erumah\u003c/a\u003e.", "id": "\u003ch1\u003eKesalahan(5xx)\u003c/h1\u003eAda yang salah. Jangan cemas, file Anda tetap aman dan Dropboxer sudah diberi tahu. Kunjungi \u003ca href=\"https://www.dropbox.com/help\"\u003ePusat Bantuan\u003c/a\u003e dan \u003ca href=\"https://forums.dropbox.com\"\u003eforum\u003c/a\u003e kami untuk mendapatkan bantuan, atau kembalilah ke \u003ca href=\"https://www.dropbox.com/home\"\u003ehalaman awal\u003c/a\u003e.", "th_TH": "\u003ch1\u003e\u0e02\u0e49\u0e2d\u0e1c\u0e34\u0e14\u0e1e\u0e25\u0e32\u0e14 5xx\u003c/h1\u003e\u0e21\u0e35\u0e1a\u0e32\u0e07\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e17\u0e35\u0e48\u0e44\u0e21\u0e48\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07 \u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e40\u0e1b\u0e47\u0e19\u0e2b\u0e48\u0e27\u0e07 \u0e44\u0e1f\u0e25\u0e4c\u0e02\u0e2d\u0e07\u0e04\u0e38\u0e13\u0e22\u0e31\u0e07\u0e1b\u0e25\u0e2d\u0e14\u0e20\u0e31\u0e22\u0e41\u0e25\u0e30 Dropboxer \u0e44\u0e14\u0e49\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e41\u0e08\u0e49\u0e07\u0e40\u0e15\u0e37\u0e2d\u0e19\u0e41\u0e25\u0e49\u0e27 \u0e42\u0e1b\u0e23\u0e14\u0e14\u0e39\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e17\u0e35\u0e48 \u003ca href=\"https://www.dropbox.com/help\"\u003e\u0e28\u0e39\u0e19\u0e22\u0e4c\u0e04\u0e27\u0e32\u0e21\u0e0a\u0e... \u0e41\u0e25\u0e30 \u003ca href=\"https://forums.dropbox.com\"\u003e\u0e1f\u0e2d\u0e23\u0e31\u0e21\u003c/a\u003e \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e02\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e0a\u0e48\u0e27\u0e22\u0e40\u0e2b\u0e25\u0e37\u0e2d \u0e2b\u0e23\u0e37\u0e2d\u0e01\u0e25\u0e31\u0e1a\u0e44\u0e1b\u0e17\u0e35\u0e48 \u003ca href=\"https://www.dropbox.com/home\"\u003e\u0e2b\u0e19\u0e49\u0e32\u0e41\u0e23\u0e01\u003c/a\u003e", "es_ES": "\u003ch1\u003eError (5xx)\u003c/h1\u003eSe ha producido un error. No te preocupes, los archivos est\u00e1n a salvo y los Dropboxers est\u00e1n al tanto. Visita nuestro \u003ca href=\"https://www.dropbox.com/help\"\u003eCentro de ayuda\u003c/a\u003e y los \u003ca href=\"https://forums.dropbox.com\"\u003eforos\u003c/a\u003e si necesitas que te echen una mano, o bien vuelve a la \u003ca href=\"https://www.dropbox.com/home\"\u003ep\u00e1gina principal\u003c/a\u003e.", "ja": "\u003ch1\u003e\u30a8\u30e9\u30fc\uff085xx\uff09\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u003c/h1\u003e\u30d5\u30a1\u30a4\u30eb\u306f\u5b89\u5168\u3067\u3059\u306e\u3067\u3054\u5fc3\u914d\u3044\u308a\u307e\u305b\u3093\u3002Dropboxer \u306b\u306f\u65e2\u306b\u901a\u77e5\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u003ca href=\"https://www.dropbox.com/help\"\u003e\u30d8\u30eb\u30d7\u30bb\u30f3\u30bf\u30fc\u003c/a\u003e\u3084\u... href=\"https://forums.dropbox.com\"\u003e\u30d5\u30a9\u30fc\u30e9\u30e0\u003c/a\u003e\u3092\u53c2\u7167\u30... href=\"https://www.dropbox.com/home\"\u003e\u30db\u30fc\u30e0\u003c/a\u003e] \u30da\u30fc\u30b8\u306b\u623b\u3063\u3066\u304f\u3060\u3055\u3044\u3002", "pl": "\u003ch1\u003eB\u0142\u0105d (5xx)\u003c/h1\u003eWyst\u0105pi\u0142y problemy. Nie martw si\u0119, Twoje pliki s\u0105 nadal bezpieczne, a pracownicy us\u0142ugi Dropbox zostali powiadomieni. Odwied\u017a \u003ca href=\"https://www.dropbox.com/help\"\u003eCentrum pomocy\u003c/a\u003e i \u003ca href=\"https://forums.dropbox.com\"\u003efora\u003c/a\u003e, aby uzyska\u0107 pomoc, lub przejd\u017a do \u003ca href=\"https://www.dropbox.com/home\"\u003estrony g\u0142\u00f3wnej\u003c/a\u003e."};
function read_cookie (name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1, c.length);
}
if (c.indexOf(nameEQ) === 0) {
return c.substring(nameEQ.length, c.length);
}
}
return null;
}
Event.observe(document, 'dom:loaded', function () {
var locale = read_cookie('locale');
if (locale) {
var msg = message[locale];
if (msg) {
$('errorbox').update(msg);
}
}
});
</script>

</body>
</html>

Greg-DB
Dropbox Staff

Thanks! It looks like you're not using an official SDK so it's hard to say off hand if there's anything wrong about how the request is being built. Nothing looks obviously wrong. Are you able to enable any extra debugging output by any chance, e.g., to show the raw request?

Also, how long does that call take before the call fails? 

Greg-DB
Dropbox Staff

Oh, never mind, I think I see the issue. It looks like you're missing the quotes around the session_id in the Dropbox-API-Arg header, as well a the ending "}". That's likely corrupting the HTTP request, causing the server to fail back with the HTML page.

I recommend using a JSON library to build these strings for you, instead of doing so manually.

hbtest
New member | Level 1

Thank you a lot, Gregory. Now it works just fine!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    hbtest New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?