Error: Unknown dialect undefined

Hi, I’m having this error while deploying my Strapi app to Azure.

[2023-08-29 09:58:09.863] debug: ⛔️ Server wasn't able to start properly.
[2023-08-29 09:58:09.866] error: Unknown dialect undefined
Error: Unknown dialect undefined
    at getDialectName (/home/vsts/work/1/release/node_modules/@strapi/database/lib/dialects/index.js:36:13)
    at getDialect (/home/vsts/work/1/release/node_modules/@strapi/database/lib/dialects/index.js:42:23)
    at new Database (/home/vsts/work/1/release/node_modules/@strapi/database/lib/index.js:31:20)
    at Function.Database.init (/home/vsts/work/1/release/node_modules/@strapi/database/lib/index.js:121:14)
    at Strapi.bootstrap (/home/vsts/work/1/release/node_modules/@strapi/strapi/lib/Strapi.js:422:30)
    at Strapi.load (/home/vsts/work/1/release/node_modules/@strapi/strapi/lib/Strapi.js:493:16)
    at async Strapi.start (/home/vsts/work/1/release/node_modules/@strapi/strapi/lib/Strapi.js:218:9)
##[error]Bash exited with code '1'.

My dependencies:

"dependencies": {
    "@hapi/boom": "^10.0.1",
    "@strapi/plugin-i18n": "4.12.4",
    "@strapi/plugin-users-permissions": "4.12.4",
    "@strapi/strapi": "4.12.4",
    "better-sqlite3": "8.5.0",
    "mysql": "^2.18.1",
    "pg": "^8.11.3",
    "sharp": "^0.32.5"
  },

Node version is v16.20.2;

Npm version is 8.19.4;

My ./config/database.js

module.exports = ({ env }) => ({
  connection: {
    client: "postgres",
    debug: true,
    connector: "bookshelf",
    connection: {
      connectionString: env("DATABASE_URL", ""),
      host: env("PostreSQLDbHost", "localhost"),
      port: 5432,
      database: env("PostreSQLDbName"),
      user: env("PostreSQLServerAdministratorLogin"),
      password: env("PostreSQLServerAdministratorPassword"),
      ssl: env.bool("DATABASE_SSL", false) && {
        key: env("DATABASE_SSL_KEY", undefined),
        cert: env("DATABASE_SSL_CERT", undefined),
        ca: env("DATABASE_SSL_CA", undefined),
        capath: env("DATABASE_SSL_CAPATH", undefined),
        cipher: env("DATABASE_SSL_CIPHER", undefined),
        rejectUnauthorized: env.bool("DATABASE_SSL_REJECT_UNAUTHORIZED", true),
      },
      schema: env("DATABASE_SCHEMA", "public"),
    },
    pool: {
      min: env.int("DATABASE_POOL_MIN", 2),
      max: env.int("DATABASE_POOL_MAX", 10),
    },
    acquireConnectionTimeout: env.int("DATABASE_CONNECTION_TIMEOUT", 60000),
  },
});

Everything is running ok in local, but in the pipeline it would give the error.

@Michele_Boi Did you manage to solve it? I have a similar problem, locally it works, but in the pipeline it gives the error.

Did you find a solution? I have the same error.

This might be caused by DATABASE_CLIENT value missing in env. Check if this value exists in your env and is one of mysql, mysql2, postgres, or sqlite.