Influxdb v2 Flux datasource yaml unable to authorize with token, but work manually on web UI

I have the following datasource.yaml to provision Grafana9.3.6 and InfluxDB 2.6.1 on Docker

apiVersion: 1

datasources:
  - name: k6    
    type: influxdb
    url: http://influxdb:8086
    access: proxy
    isDefault: true
    orgId: 1
    uid: z8DNrUAVz
    jsonData:
      version: Flux
      defaultBucket: k6
      organization: holoplot
      tlsSkipVerify: true
    secureJsonData:
      token: MYTOKEN

But after launch, it shows unauthorized access error reading buckets. And on InfluxDB log it said Authorization not found.

However, in the same UI without relaunching, I can create a new datasource and manually adding exactly the same information and token. The connection worked.

Any suggestion why this might be ?

This is the docker compose

version: "3.7"

services:
  influxdb:
    image: influxdb:2.6.1
    ports:
      - 8086:8086
    volumes:
      - influxdb-storage:/var/lib/influxdb:rw
    env_file:
      - .env
    entrypoint: ["./entrypoint.sh"]

  grafana:
    image: grafana/grafana:9.3.6
    ports:
      - 3000:3000
    volumes:
      - grafana-storage:/var/lib/grafana:rw
      - ./grafana-provisioning/:/etc/grafana/provisioning:rw
    depends_on:
      - influxdb

volumes:
  influxdb-storage:
  grafana-storage:

grafana-provisioning folder consist of

  • datasources/datasource.yaml

Environment: Docker

  • Grafana version: 9.3.6
  • Data source type & version: InfluxDB v2
  • User OS & Browser: macOS M1, 12.6