# InfluxDB connection error

**URL:** <https://discourse.nodered.org/t/influxdb-connection-error/45094>\
**Category:** General\
**Created:** [3 May 2021 07:29 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094 "2021-05-03T07:29:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![LukasSmolarik](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@LukasSmolarik](https://discourse.nodered.org/u/LukasSmolarik)\
**Post date:** [3 May 2021 07:29 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/1 "2021-05-03T07:29:46Z")

</div>

Hello

I have problem with node influxdb in.

I have error: HttpError: 500 Internal Server Error : {"error":"loc 1:12-1:13: invalid statement @1:12-1:13: ,"}

I have home assistant with addon Node red. Data to influxdb work.

Can you help what is problem?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [3 May 2021 08:50 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/2 "2021-05-03T08:50:55Z")

</div>

From that error it sounds like you have an invalid statement.

How are you sending a query to influx?  
What does the msg being sent look like? (Connect a `debug` node to the node sending the query to the influx-in node and set it to display the complete msg object)

---

<div class="post-metadata">

**Author:** ![LukasSmolarik](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@LukasSmolarik](https://discourse.nodered.org/u/LukasSmolarik)\
**Post date:** [3 May 2021 09:07 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/3 "2021-05-03T09:07:42Z")

</div>

msg.query = 'SELECT time, celsius FROM "ProjectData01"."Temperature"."Outdoor" WHERE time \> now()';

return msg;

i tested all and nothing.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 May 2021 09:25 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/4 "2021-05-03T09:25:40Z")

</div>

> [@LukasSmolarik](#):
>
> WHERE time \> now()

You appear to be asking for only data in the future, though I would not expect that to give the error you are seeing.

Are you using the influxdb Out node to write data successfully? Can you export the function node, InfluxDB In node and the Influxdb Out node that works please and paste them here.

See this post for more how to post flows - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![LukasSmolarik](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@LukasSmolarik](https://discourse.nodered.org/u/LukasSmolarik)\
**Post date:** [3 May 2021 09:52 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/5 "2021-05-03T09:52:31Z")

</div>

> [@LukasSmolarik](#):
>
> msg.query = 'SELECT time, celsius FROM "ProjectData01"."Temperature"."Outdoor" WHERE time \> now()';
> 
> return msg;

sorry f.e  
now() - 6h';

influxdb out: this is working!

```auto
[{"id":"32f2f3d.1e8eb0c","type":"influxdb out","z":"1d03c38.8213fbd","g":"ea0777be.9c085","influxdb":"a5b4acaa.45e12","name":"InfluxDB","measurement":"Outdoor","precision":"","retentionPolicy":"","database":"ProjectData01","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"Temperature","org":"organisation","bucket":"bucket","x":780,"y":260,"wires":[]},{"id":"a5b4acaa.45e12","type":"influxdb","hostname":"192.168.50.250","port":"8096","protocol":"http","database":"ProjectData01","name":"MyConnect","usetls":false,"tls":"","influxdbVersion":"1.8-flux","url":"http://192.168.50.250:8096","rejectUnauthorized":true}]

```

influxdb in:

```auto
[{"id":"3e88cb3a.4635c4","type":"function","z":"b90ea9f2.7fe938","name":"new time scale","func":"\n//msg.query = \"SELECT time, celsius FROM ProjectData01.Temperature.Outdoor WHERE time > now() - \" + msg.payload;\n\nmsg.query = 'SELECT time, celsius FROM \"ProjectData01\".\"Temperature\".\"Outdoor\" WHERE time > now() - 6h';\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":780,"y":100,"wires":[["a4bc1a59.1df978"]]},{"id":"a4bc1a59.1df978","type":"influxdb in","z":"b90ea9f2.7fe938","influxdb":"a5b4acaa.45e12","name":"Influx","query":"","rawOutput":false,"precision":"","retentionPolicy":"","org":"organisation","x":950,"y":100,"wires":[["4859b4e6.35b51c","19d71a3d.a98b5e"]]},{"id":"a5b4acaa.45e12","type":"influxdb","hostname":"192.168.50.250","port":"8096","protocol":"http","database":"ProjectData01","name":"MyConnect","usetls":false,"tls":"","influxdbVersion":"1.8-flux","url":"http://192.168.50.250:8096","rejectUnauthorized":true}]

```

Admin edit: modified so that flows are importable.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [3 May 2021 10:47 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/6 "2021-05-03T10:47:15Z")

</div>

You did not read the link I posted carefully, I have editted your post so the flows are importable.

You have configured the config node as 1.8x-Flux which means that you are using Influx 1.8 but want to use the Flux query language. But the query you have used is not a Flux query, it is influx SQL. Either change the config to 1.x type, or use a Flux query.

---

<div class="post-metadata">

**Author:** ![LukasSmolarik](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@LukasSmolarik](https://discourse.nodered.org/u/LukasSmolarik)\
**Post date:** [3 May 2021 15:08 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/7 "2021-05-03T15:08:26Z")

</div>

great, it is work.

thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [17 May 2021 15:08 UTC](https://discourse.nodered.org/t/influxdb-connection-error/45094/8 "2021-05-17T15:08:45Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
