-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node request fails if response takes longer than 5 minutes (300s) #1513
Comments
the |
@jkaster yes, and that doesn't matter when using the sdk from node when a request takes longer than 300 seconds to return1. Looker's In my
However, in practice any query I try to run that exceeds the 300 second limit imposed by node's 1 This is documented by numerous respondents on the referenced node issue as well as trivially demonstrated (at least for the // file: server.mjs
// node server.mjs
import http from 'http';
const server = http.createServer((req, res) => {
// get timeout length from the path /timeout/:timeout
// return 200 ok after the timeout
const timeout = parseInt(req.url.split('/')[1]);
console.log(`received request for timeout: ${timeout}`);
setTimeout(() => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('{"status": "ok", "timeout_sec": ' + timeout + '}');
}, timeout * 1000);
});
server.listen(8080);
console.log('Server running at http://localhost:8080/');
setTimeout(() => {
server.close();
}, 330 * 1000);
const done = new Promise((resolve) => {
server.on('close', () => {
resolve();
});
});
async function makeCall(timeout) {
const start = Date.now();
try {
const res = await fetch(`http://localhost:8080/${timeout}`);
const json = await res.json();
console.log(json);
} catch (e) {
console.error(`timeout ${timeout} errored after ${(Date.now() - start) / 1000}s`, e);
}
}
Array.from(Array(330).keys()).forEach((sec) => {
if (sec % 10 === 0 || (sec > 295 && sec < 305)) {
makeCall(sec);
}
})
await done; |
As documented in this issue Node's
fetch
implementation has a hard cap on timeout of 300s. It appears to be the case that their underlying nodejs http lib supports longer timeouts, up to infinity. However there is no way for me to configure that in the current node implementation.See my comment for the results of my digging on this.
The text was updated successfully, but these errors were encountered: