I use following code for a OpenStreetMap-query (overpass-API). It works fine on smaller querys but on a bigger one, which takes around 10 min, it generates only a 504 gateway timeout response.
code:
var reqStr = "http://overpass.osm.rambler.ru/cgi/interpreter?data=...
console.time("query");
var stream = request(reqStr,{timeout: 3600000}).on('error', function(err) {
console.log(err)
}).pipe(fs.createWriteStream('resultExport.json'));
stream.on('finish', function () {
console.timeEnd("query");
});
response (resultExport.json):
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>504 Gateway Time-out</title>
</head><body>
<h1>Gateway Time-out</h1>
<p>The gateway did not receive a timely response
from the upstream server or application.</p>
</body></html>
The query command has a [timeout:3600] (seconds) and the request got {timeout: 3600000} (milliseconds). What else can i do prevent the timeout and get a proper response? I am a bit confused where this is coming from.