[Solved] Strapi Cannot destructure property 'client' of 'db.config.connection' as it is undefined

While setting up my Strapi server, I found this stupid bug and after searching over 30+ articles, I found only one working solution.

 

So, I've seen lately, the Strapi CLI  isn't working properly. I've selected the recommended option to install Strapi. After that the mess is, it didn't create tsconfig for me.  and the error is related to dbConnection.   

So searching through the internet how to fix my dbConnection, I found out that this isn't the problem with the dbConnection at all.

 

So the solution is,
if you don't see "tsconfig.json" in your project then create one, otherwise replace your tsconfig.json with the following code.

 

{
  "extends": "@strapi/typescript-utils/tsconfigs/server",
  "compilerOptions": {
    "outDir": "dist",
    "rootDir": ".",
    "lib": ["esnext", "dom"],
    "skipLibCheck": true, // Skip type checking of declaration files
    "strict": false, // Disable strict type checking
    "allowJs": true, // Allow JavaScript files to be compiled
    "checkJs": false, // Disable checking JavaScript files
    "noImplicitAny": false,
    "noImplicitThis": false
  },
  "include": [
    "./",
    "./**/*.ts",
    "./**/*.js",
    "src/**/*.json",
  ],
  "exclude": [
    "node_modules/",
    "build/",
    "dist/",
    ".cache/",
    ".tmp/",
    "src/admin/",
    "**/*.test.ts",
    "src/plugins/**",
    "types/generated/**"
  ]
}

 

It worked like charm for me, 
Of course you can try cleaning cache data if this doesn't work for you otherwise mostly its gonna work.