8000 this.dateToProtocolTimestamp is not a function · Issue #1132 · influxdata/influxdb-client-js · GitHub
[go: up one dir, main page]

Skip to content

this.dateToProtocolTimestamp is not a function #1132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the c 8000 ommunity.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
davodm opened this issue Apr 14, 2025 · 0 comments
Open

this.dateToProtocolTimestamp is not a function #1132

davodm opened this issue Apr 14, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@davodm
Copy link
davodm commented Apr 14, 2025

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

@davodm davodm added the bug Something isn't working label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant
0