Http.post() not working with https url

Hi,

We using influx tasks to create alerts and in these tasks using http.post function to send data to NodeRED for further processing, during development we used http on NodeRED but when we wanted to use https than:

could not execute task run: runtime error @94:8-128:6: map: failed to evaluate map function: error calling function “post” @68:9-88:10: Post “https://nodered…/influx”: x509: certificate signed by unknown authority

despite the certificate is not self-signed

Is there any option for http.post to skip certificate verification or how should we solved this (https is mandatory)

Thanks!

@Suhanbongo This isn’t possible with http.post(), but if you’re using InfluxDB 2.2+ or InfluxDB Cloud, you can use the new http/requests package, which is a full-featured HTTP library. Functions in this package can set an insecureSkipVerify config setting:

import "http/requests"

option requests.defaultConfig = {
    timeout: 0s,
    insecureSkipVerify: true,
}

requests.post(
    url: "https://nodered…/influx",
    body: bytes(v: "..."),
)

Note: If using InfluxDB 2.2-2.3, the requests package was experimental, so the import path would be experimental/http/requests.

Hi Scott,

We using InfluxDB v2.4.0 Server: de247ba Frontend: a2bd1f3 but despite of that it’s seems that import not working

image

Any idea what could be the issue here ?
Thanks

Update: Despite the error its working, but still not clear why we got it.

It’s because the error is being returned by the Flux LSP (language server protocol), but the LSP in the InfluxDB UI isn’t updated with every Flux version. So the LSP is currently out of sync, but the underlying binary supports the package.