InfluxDB + postgres "Error: An internal error has occurred."

Hello,
I’m trying to query a postgres db as described in the docs.

import "sql"

sql.from(
  driverName: "postgres",
  dataSourceName: "postgresql://my-usr:my-psw@postgres",
  query: "SELECT * FROM metadata"
)

where metadata is a table I created in postgres.
I also tried specifying the db as dataSourceName: "postgresql://my-usr:my-psw@postgres/my-db", but no luck.

I tried to run the query both using the UI and influx query but I always get the generic error:

Error: An internal error has occurred.

In my case, the two services are inside the same network, I’m able to ping postgres if I log into influxdb. My docker-compose looks like this:

version: "3.5"
services:
  influxdb:
    image: influxdb:2.0.4
    container_name: influxdb
    ports:
      - 8086:8086
    environment:
      - DOCKER_INFLUXDB_INIT_MODE=setup
      - DOCKER_INFLUXDB_INIT_USERNAME=my-usr
      - DOCKER_INFLUXDB_INIT_PASSWORD=my-psw
      - DOCKER_INFLUXDB_INIT_ORG=my-org
      - DOCKER_INFLUXDB_INIT_BUCKET=my-bucket
      - DOCKER_INFLUXDB_INIT_RETENTION=53w
      - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-auth-token

  postgres:
    build: postgres
    container_name: postgres
    environment:
      - POSTGRES_DB=my-db
      - POSTGRES_USER=my-usr
      - POSTGRES_PASSWORD=my-psw

How can I find additional info about the error and fix it? The generic error message is not giving me any clue.
Thanks

Found the problem, I’ll share the solution here:

import "sql"

sql.from(
  driverName: "postgres",
  dataSourceName: "postgresql://my-usr:my-psw@postgres/my-db?sslmode=disable",
  query: "SELECT * FROM metadata"
)