How do HTTPS requests work in the node.js client?


#1

I am trying to make a request to an HTTPS server with the node.js module, and it isn’t working. The actual influxdb instance is HTTPS (w/ self-signed cert) and accessible, and the query I think runs in module runs perfectly fine (ie returns results) with curl -k. My setup is this:

import { InfluxDB } from 'influx'
const influx = new InfluxDB( { 
  protocol : "https" , 
  host : "my.influxdb.instance" , 
  port : "8086" , 
  database : "telegraf" , 
  username: '...',
  password: '...',
  options : { 
    rejectUnauthorized: false , 
  }
});

and the query, unchanged from a working query with HTTP, is

influx.query(`
        select 100.0 - usage_idle as "usage" from cpu
        where host = '${name}'
        and cpu = 'cpu-total'
`)

(name is in scope). I receive no data and get a GET error; moreover I see no response details in the developer console’s Network panel for the failed requests.

If I copy and paste the encoded request to a terminal with curl -k it runs fine and I get data.