fragolinux / DockerIOT

A collection of Docker scripts to setup a complete IOT development platform
19 stars 2 forks source link

Nodered Influxdb “HttpError: unauthorized access” #3

Open Pat-78 opened 6 months ago

Pat-78 commented 6 months ago

With Nodered “influxdb out” node I get “HttpError: unauthorized access” In the node : URL : http://host:8086/ Token : “all access” generated on http://”host”:8086/org from an other computer

If I try with the container ip address of influxdb (172.25.0.2) I get “RequestTimedOutError: Request timed out”

No trouble with nodered and mosquito (with “host”)

What may be wrong ?

Nodered log with host

nodered | ERROR: Write to InfluxDB failed. m [HttpError]: unauthorized access nodered | at IncomingMessage. (/data/node_modules/@influxdata/influxdb-client/dist/index.js:5:5671) nodered | at IncomingMessage.emit (node:events:525:35) nodered | at endReadableNT (node:internal/streams/readable:1358:12) nodered | at processTicksAndRejections (node:internal/process/task_queues:83:21) { nodered | statusCode: 401, nodered | statusMessage: 'Unauthorized', nodered | body: '{"code":"unauthorized","message":"unauthorized access"}', nodered | contentType: 'application/json; charset=utf-8', nodered | json: { code: 'unauthorized', message: 'unauthorized access' }, nodered | code: 'unauthorized', nodered | _retryAfter: 0 nodered | } nodered | 9 May 05:29:42 - [error] [influxdb out:7a2338e33be9c644] HttpError: unauthorized access

nodered log with 172.35.0.1

nodered | WARN: Write to InfluxDB failed (attempt: 5). x [RequestTimedOutError]: Request timed out nodered | at ClientRequest. (/data/node_modules/@influxdata/influxdb-client/dist/index.js:5:6447) nodered | at ClientRequest.emit (node:events:513:28) nodered | at Socket.emitRequestTimeout (node:_http_client:839:9) nodered | at Object.onceWrapper (node:events:627:28) nodered | at Socket.emit (node:events:525:35) nodered | at Socket._onTimeout (node:net:550:8) nodered | at listOnTimeout (node:internal/timers:559:17) nodered | at processTimers (node:internal/timers:502:7) nodered | ERROR: Write to InfluxDB failed (attempt: 6). Error: Max retry time exceeded. nodered | at F.sendBatch (/data/node_modules/@influxdata/influxdb-client/dist/index.js:4:9024) nodered | at Timeout._onTimeout (/data/node_modules/@influxdata/influxdb-client/dist/index.js:4:6489) nodered | at listOnTimeout (node:internal/timers:559:17) nodered | at processTimers (node:internal/timers:502:7)

Pat-78 commented 6 months ago

Solved It was token related. Use the token in the .env file, not the one you can generate on the http://”host”:8086/org page. I don't know why !