InfluxDB 2.6 (Docker) no access with javascript (node.js)

Hello and a happy new year!
I am trying to setup influxdb 2.6 using docker.
The instance is running and i can access the influxdb page in my localhost.

But when I try to access the database with javascript it gives me an 401 error, saying that i dont have permission.

This is the js code:

const Influx = require('influx');

const influx = new Influx.InfluxDB({
    host: 'localhost',
    port: 8086,
    database: 'gasometer',
    username: 'admin',
    password: 'adminsecret',
});

export const getDatabases = async () => {
    console.log(await influx.getDatabaseNames());
}

I cant pass the api key into the config above, as there is no ‘api’ field showing up for me.

I also heard that one have to customize the config file, but there is no config file for me.
This is my docker code:

docker run -d -p 8086:8086 --name influxdb -v %cd%/data:/var/lib/influxdb -v %cd%/config:/etc/influxdb amd64/influxdb 

It creates the config folder but with no content in it.

I also tried to pass the INFLUXD_CONFIG_PATH but it also had no effect.
This was the command for that:

docker run -d -p 8086:8086 --name influxdb -v %cd%/data:/var/lib/influxdb -v %cd%/config:/etc/influxdb -e INFLUXD_CONFIG_PATH=%cd%/config/etc/influxdb amd64/influxdb 

Any help is highly appreciated.

Thanks! :slight_smile: