Skip to content
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 community.

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

TypeError: text.replace is not a function #12

Open
olonsoft opened this issue Mar 8, 2021 · 1 comment
Open

TypeError: text.replace is not a function #12

olonsoft opened this issue Mar 8, 2021 · 1 comment

Comments

@olonsoft
Copy link

olonsoft commented Mar 8, 2021

The following is the payload that I send and the error that I get:

{
  "payload": {
    "bucket": "weather-data",
    "precision": "ms",
    "data": [
      {
        "measurement": "weatherdata",
        "tags": {
          "device_sn": "SK-00000732",
          "firmware_revision": 43,
          "report_interval": 1,
          "wind_sample_interval": 3,
          "precipitation_type": 0
        },
        "fields": {
          "wind_speed": 0.89,
          "wind_lull": 0,
          "wind_gust": 1.74,
          "wind_direction": 144,
          "uv_index": 0,
          "illuminance": 0,
          "solar_radiation": 0,
          "battery": 3.25,
          "rain_accumulated": 0
        },
        "timestamp": 1615224793257
      }
    ]
  },
  "_session": {
    "type": "websocket",
    "id": "315a89d2.d2f9f6"
  },
  "_msgid": "ea8958bf.3574c8",
  "error": {
    "message": "TypeError: text.replace is not a function",
    "source": {
      "id": "ceb1cd06.6c177",
      "type": "Stackhero-InfluxDB-v2-write",
      "name": "influxdb2write",
      "count": 1
    },
    "stack": "TypeError: text.replace is not a function\n    at escape (/data/node_modules/influxdb-v2/src/index.js:101:25)\n    at Object.keys.map.tagKey (/data/node_modules/influxdb-v2/src/index.js:107:67)\n    at Array.map (<anonymous>)\n    at lines.map (/data/node_modules/influxdb-v2/src/index.js:107:12)\n    at Array.map (<anonymous>)\n    at Influxdb.write (/data/node_modules/influxdb-v2/src/index.js:95:8)\n    at InfluxDbV2Node.write (/data/node_modules/node-red-contrib-stackhero-influxdb-v2/src/main.js:28:34)\n    at process._tickCallback (internal/process/next_tick.js:68:7)"
  }
}
@tito
Copy link

tito commented Nov 16, 2021

I got this error too. It appears that passing non-string in tags is what throw an exception.
By using JSON.stringify() on all tags, it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants