【发布时间】:2021-06-17 23:22:42
【问题描述】:
我正在尝试使用 influxdb-client 从我的 node.js 中的 InfluxDB 服务器获取数据,但是当我执行查询时,我收到“TypeError: t.complete is not a function”错误。 我可以在控制台中看到客户端获取数据,然后产生此错误。
来自 JS 客户端的代码:
const fluxQuery =
'from(bucket:"data") |> range(start: 0) |> filter(fn: (r) => r._measurement == "devices") |> filter(fn: (r) => r["_field"] == "wreal1") |> last()';
queryApi.queryRows(fluxQuery, {
next(row, tableMeta) {
const o = tableMeta.toObject(row)
console.log(o)
}
});
控制台:
{
result: '_result',
table: 0,
_start: '2021-06-17T22:31:04.305309987Z',
_stop: '2021-06-17T23:02:08.128895474Z',
_time: '2021-06-17T23:02:07.278424896Z',
_value: 3159.7,
_field: 'wreal1',
_measurement: 'devices',
disp: '1'
}
C:\Users\usuario\Desktop\proyecto\node_modules\@influxdata\influxdb-client\dist\index.js:1
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("URL"),
.................
return G(t.toString())}const K="function"==typeof Symbol&&Symbol.observable||"@@observable";
TypeError: t.complete is not a function
at Object.complete (C:\Users\usuario\Desktop\proyecto\node_modules\@influxdata\influxdb-client\dist\index.js:1:4568)
at Object.complete (C:\Users\usuario\Desktop\proyecto\node_modules\@influxdata\influxdb-client\dist\index.js:1:948)
at IncomingMessage.complete (C:\Users\usuario\Desktop\proyecto\node_modules\@influxdata\influxdb-client\dist\index.js:16:8791)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
[nodemon] app crashed - waiting for file changes before starting...
我正在使用模块中的 1.14 版本,我尝试安装 1.13 版本但同样的错误。
【问题讨论】:
标签: javascript node.js influxdb