'WARN: Write to InfluxDB failed [[RequestTimedOutError]]

WARN: Write to InfluxDB failed (attempt: 1). Error: 
at S.<anonymous> (/Users/sathish/Documents/sample/raviAPI/node_modules/core-js/internals/wrap-error-constructor-with-cause.js:37:62)
at new super (/Users/sathish/Documents/sample/raviAPI/node_modules/core-js/modules/es.error.cause.js:28:43)
at new S (/Users/sathish/Documents/sample/raviAPI/node_modules/@influxdata/influxdb-client/src/errors.ts:163:5)
at ClientRequest.<anonymous> (/Users/sathish/Documents/sample/raviAPI/node_modules/@influxdata/influxdb-client/src/impl/node/NodeHttpTransport.ts:346:23)
at ClientRequest.emit (events.js:314:20)
at ClientRequest.EventEmitter.emit (domain.js:483:12)
at Socket.emitRequestTimeout (_http_client.js:715:9)
at Object.onceWrapper (events.js:420:28)
at Socket.emit (events.js:326:22)
at Socket.EventEmitter.emit (domain.js:483:12)
at Socket._onTimeout (net.js:483:8)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) 

name: 'RequestTimedOutError', message: 'Request timed out'

I am facing this issue while writing data for each second in influxdb. This is the influxdb client i am using from nodejs @influxdata/influxdb-client



Solution 1:[1]

It would be easier to answer this if you would post some of the code here.

looks like classing http request timeout https://github.com/influxdata/influxdb-client-js/blob/558b3b4f6a5fd1e94c1579bd894cb0ce5e126368/packages/core/src/impl/node/NodeHttpTransport.ts#L345

which comes from regular nodejs http.IncomingMessage

https://github.com/influxdata/influxdb-client-js/blob/558b3b4f6a5fd1e94c1579bd894cb0ce5e126368/packages/core/src/impl/node/NodeHttpTransport.ts#L47

you can read more about timeouts here https://nodejs.org/api/http.html#event-timeout

Whatever timeout setting you are using is too low for the server to respond. Default Agent has timeout options in milliseconds, probably there is a way to configure that in this node module as well. https://nodejs.org/api/http.html#new-agentoptions https://github.com/influxdata/influxdb-client-js/blob/558b3b4f6a5fd1e94c1579bd894cb0ce5e126368/packages/core/src/impl/node/NodeHttpTransport.ts#L62

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mpod