influxdb-client-js
influxdb-client-js copied to clipboard
this.dateToProtocolTimestamp is not a function
Specifications
- Client Version: 1.35.0
- InfluxDB Version: 2.7.11
- Platform: MacOs
Code sample to reproduce problem
function _createBasePoint(options = {}) {
const {
operation,
requestId,
status,
tokenId,
userId,
endpoint = 'unknown',
timestamp = new Date(),
} = options;
const point = new Point(MEASUREMENT_NAME)
.tag('operation', operation)
.tag('status', status)
.tag('request_id', requestId)
.tag('endpoint', endpoint)
timestamp
if (tokenId) point.tag('token_id', tokenId);
if (userId) point.tag('user_id', userId);
return point;
}
let point =_createBasePoint({
operation: 'start',
requestId,
status: 'pending',
tokenId,
userId,
endpoint: metadata?.endpoint || 'unknown',
timestamp: new Date(),
});
// Add specific fields to this "start" operation
point.floatField('estimated_amount', estimatedAmount);
point.floatField('balance_before', tokenDoc.balance || 0);
})
Expected behavior
I expected to parse the Date() as it should.
Actual behavior
I'm using the nodejs client to interact with influxdb, but in sending timestamp as new Date (it's exactly like the example file) it throws this error:
TypeError: this.dateToProtocolTimestamp is not a function at E.convertTime (./node_modules/@influxdata/influxdb-client/dist/index.mjs:5:1242) at Fe.toLineProtocol (./node_modules/@influxdata/influxdb-client/dist/index.mjs:4:3994) at E.writePoint (./node_modules/@influxdata/influxdb-client/dist/index.mjs:5:481)
Additional info
No response