mblackstock / node-red-contrib-influxdb

Node-RED nodes to save and query data from an influxdb time series database
Other
64 stars 46 forks source link

batch node not working - #58

Closed juggledad closed 4 years ago

juggledad commented 4 years ago

28 May 12:03:15 - [info] Node-RED version: v1.0.6 28 May 12:03:15 - [info] Node.js version: v12.13.0 28 May 12:03:15 - [info] Darwin 18.7.0 x64 LE

While the 'influxdb out' node is working fine, the 'influx batch' node does not work.

Using the example flow provided in the nodes flow page, the following error is reported in a catch node:

Error: write EPROTO 4488598976:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

and the stack shows

Error: write EPROTO 4488598976:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332: at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:87:16)

mblackstock commented 4 years ago

Just tested, and seems to work fine. Ensure the SSL settings on your influxdb server and the influxdb configuration node are correct.

juggledad commented 4 years ago

Just to let you know, the 'influxdb out' works fine using the same configuration. Why would there be an error when using 'influxdb batch' when 'influx out' works?

mblackstock commented 4 years ago

Not sure why you're seeing this. In the code, I can see that the batch node configures the InfluxDB client library in the same way as the regular out node.

For my tests I used the same configuration including set up for both the out and batch nodes. Tried a self signed cert configuration and a non-encrypted configuration for the same simple flows. Both worked for me. Do you have a test flow and some screen shots of your configuration you can send me?

juggledad commented 4 years ago

Ahhh I discovered what is causing this. If the database does not exist, the error will occur. I opened this issue because I was replicating the error a user on the Node-RED forum had. Using a valid database and batch works fine.

It would be nice if it just said the database didn't exist

mblackstock commented 4 years ago

I get this error when a database I try to write to with the batch node doesn't exist, so not sure that's the issue.

Error: A 404 Not Found error occurred: {"error":"database not found: \"test2\""}↵↵ at IncomingMessage.<anonymous> (/Users/mike/dev/sts/node-red/node_modules/node-red-contrib-influxdb/node_modules/influx/lib/src/pool.js:49:38)↵ at IncomingMessage.emit (events.js:215:7)↵ at endReadableNT (_stream_readable.js:1184:12)↵ at processTicksAndRejections (internal/process/task_queues.js:80:21)"

If I stop my local instance of influxdb I get this error: Error: connect ECONNREFUSED 127.0.0.1:8086 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14)

If I try to access using HTTP, when HTTPS is required I get this: Error: A 400 Bad Request error occurred: Client sent an HTTP request to an HTTPS server.

If I configure my influxdb server to not use SSL, but then try to connect to it with SSL I get this error: Error: write EPROTO 4512783808:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:↵"

This may not be the best error, I think that must be similar to your setup.

Either way, It looks like we're reporting errors from the underlying library correctly, and the batch node is fine so I'll close this.