Node-RED通过HTTP向InfluxDB写入数据报错问题求助
Let's break down why you're hitting this error and how to fix it quickly:
The Root Cause
Your working curl command sends the InfluxDB line protocol as raw plain text, but your Node-RED HTTP Request node is wrapping that line protocol in a JSON object (as seen in the error message: {"url":"...","method":"POST","body":"..."}). InfluxDB tries to parse this entire JSON string as line protocol, which obviously doesn't match the expected format—hence the "missing tag value" error.
Step-by-Step Fix
Configure the HTTP Request Node Correctly
- Double-click the HTTP Request node to open its settings:
- Set
MethodtoPOST - Enter your full InfluxDB write URL:
http://192.168.1.116:8086/write?db=waterlevel - Go to the Body tab:
- Select
Stringas the body type (not JSON) - Paste your line protocol directly into the input field:
vattenstand,lake=siljan,region=dalarna value=160.80
- Select
- Go to the Headers tab:
- Click
Add header - Set the header key to
Content-Typeand the value totext/plain(this tells InfluxDB exactly what format the body is in)
- Click
- Set
- Save the node configuration and deploy your flow.
- Double-click the HTTP Request node to open its settings:
Verify the Fix
When you trigger the flow, the Node-RED node will now send the exact same raw plain text payload that yourcurlcommand uses—InfluxDB will parse it correctly and write the data without errors.
Why This Works
Your curl command uses --data-binary to send the line protocol as raw text. By setting the Node-RED node to send a plain string body with the text/plain content type, you're replicating that exact behavior, which aligns with InfluxDB's /write endpoint requirements.
内容的提问来源于stack exchange,提问作者m4rt1n

