-
Notifications
You must be signed in to change notification settings - Fork 729
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
Request time out after 30 seconds #1791
Comments
This issue is stale because it has been open 90 days with no activity. Remove the |
@JoshMock do you have any news about this issue? |
Seems to do the trick & allow the diff --git a/node_modules/@elastic/elasticsearch/lib/client.js b/node_modules/@elastic/elasticsearch/lib/client.js
index 6952327..4dc718b 100644
--- a/node_modules/@elastic/elasticsearch/lib/client.js
+++ b/node_modules/@elastic/elasticsearch/lib/client.js
@@ -180,7 +180,13 @@ class Client extends api_1.default {
diagnostic: this.diagnostic,
caFingerprint: options.caFingerprint
});
- this.connectionPool.addConnection((_d = options.node) !== null && _d !== void 0 ? _d : options.nodes);
+ this.connectionPool.addConnection((_d = options.node) !== null && _d !== void 0 ? {
+ url: new URL(_d),
+ timeout: options.requestTimeout
+ } : {
+ ...options.nodes,
+ timeout: options.requestTimeout
+ });
}
this.transport = new options.Transport({
diagnostic: this.diagnostic, This can be patched using patch-package. |
Do we have any update on the issue? |
This is still a relevant issue. I've been on leave for the past 2 months, so am just getting back to work on this project. |
A fix was merged in #2159, which will be available in 8.13 when it is released next week. |
🐛 Bug Report
Hi, I found a bug with request timeout and I am not sure if it belongs here or in @elastic/transport. The problem is: if you set
requestTimeout
bigger than 30 seconds and passnode
as a string in the newClient
, you are ignored and your requests get timed out after 30 seconds with the exception messageRequest timed out.
To Reproduce
Expected behavior
I would expect that I could have bulk requests longer than 30 seconds.
Problem explanation
When we are creating a new Client without an existing connection or connectionPool, then it gets created but with a max timeout of 30 seconds:
elasticsearch-js/src/client.ts: 231
addConnection
acceptstype AddConnectionOptions = string | ConnectionOptions;
and if pass string then it will be transformed into URL and with it, a newUndiciConnection
will be created.UndiciConnection
extendsBaseConnection
which at construction accept alsotimeout
parameter which is then set toheadersTimeout
andbodyTimeout
. If the timeout is not passed it uses the default 30 seconds.Since the code in client.ts:231 does not pass object with the timeout parameter, it creates a connection with the default 30 seconds timeout.
So if we execute a call with a longer duration, we will receive the message
Request timed out.
despite we set the request timeout to 60 seconds. It does not help even if we set therequestTimeout
parameter at the bulk function call.Temporary workaround
@elastic/elasticsearch
version: ~8.4.0FYI: We did not get this error in version 7.17.
The text was updated successfully, but these errors were encountered: