coussej / node-opcua-logger

An OPCUA Client for logging data to InfluxDB! 🔌 🏭
https://www.factry.io
MIT License
181 stars 65 forks source link

Help on error with starting #14

Closed haavissa closed 5 years ago

haavissa commented 5 years ago

I am wondering if you could help me with this error I am getting when trying to run node logger.js:

Error: influx_1 : starting writepump [ writeLimit: 1000 , writeInterval: 3000 ]. /Users/Sanna/node-opcua-logger/node_modules/better-assert/index.js:37 throw err; ^

AssertionError [ERR_ASSERTION]: fs.existsSync(options.certificateFile) at new AssertionError (internal/errors.js:102:11) at assert (/Users/Sanna/node-opcua-logger/node_modules/better-assert/index.js:32:13) at OPCUAClientBase (/Users/Sanna/node-opcua-logger/node_modules/node-opcua/lib/client/client_base.js:65:5) at new OPCUAClient (/Users/Sanna/node-opcua-logger/node_modules/node-opcua/lib/client/opcua_client.js:67:21) at new ReadPump (/Users/Sanna/node-opcua-logger/readpump.js:8:21) at Object. (/Users/Sanna/node-opcua-logger/logger.js:15:10) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12)

Config file looks like this: [input] url = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer" failoverTimeout = 5000 # time to wait before reconnection in case of failure

[output] name = "influx_1" type = "influxdb" host = "127.0.0.1" port = 8088 protocol = "http" username = "" password = "" database = "pilot" failoverTimeout = 10000 bufferMaxSize = 64 writeInterval = 3000 writeMaxPoints = 1000

A polled node:

[[measurements]] name = "Int32polled" tags = { tag1 = "test", tag2 = "AB43" } nodeId = "ns=2;i=10849" collectionType = "polled" pollRate = 20 # samples / minute. deadbandAbsolute = 0 # Absolute max difference for a value not to be collected deadbandRelative = 0.0 # Relative max difference for a value not to be collected

A monitored node

[[measurements]] name = "Int32monitored" tags = { tag1 = "test", tag2 = "AB43" } nodeId = "ns=2;i=10849" collectionType = "monitored" monitorResolution = 1000 # ms

I am able to connect with the OPC with a client. I am also able to write to InfluxDB on command line.

Thank you.

coussej commented 5 years ago

Hello @haavissa,

This seems te be an issue with certificate generation of the older OPCUA lib on MacOS. I've updated the code to include a more recent version op OPCUA, which should fix this.

can you try the following in your copy:

rm -rf node_modules
git pull
npm install

... and then try again?

When I find the time, I'll update other parts of the code as well, we have done quite some improvements that I also want to include in the OS version.