Knex: Required configuration option 'client' is missing

Hello!

I’m totally new to the back-end world, having been a front-end engineer for many years…this is me trying to branch out and use strapi. So this is very possibly something dumb…but why do I get “knex: Required configuration option ‘client’ is missing.”?

I don’t even know what “knex” is.

This is when I’m trying to deploy, and start the app using yarn start - build is successful prior to this.

==> Running 'yarn start'

Mar 19 09:18:50 AMyarn run v1.22.22

Mar 19 09:18:50 AM$ strapi start

Mar 19 09:19:10 AM[2024-03-19 09:19:10.106] debug: ⛔️ Server wasn't able to start properly.

Mar 19 09:19:10 AM[2024-03-19 09:19:10.108] error: knex: Required configuration option 'client' is missing.

Mar 19 09:19:10 AMError: knex: Required configuration option 'client' is missing.

Looking at the configuration options in Knex’s docs, you need to pass a client (e.g. mysql, pg, and others) in its initial configuration in your code.

From Render’s Postgres example, just to pluck one as a reference, we can see that the client gets defined in ./config/database.js.

Hmmm…thanks…I guess Knex is something Strapi uses…so maybe it goes in my database.ts file, where I define my username/database etc for Strapi?

There is no reference to Knex in my code, bar the yarn.lock file, and everything works fine locally.

That seems like the right place!

I edited my previous message a bit late probably, but you can reference Render’s example as linked in that edit.

1 Like

I was referring to sqlite in my client instead of postgres!

const client = env(“DATABASE_CLIENT”, “postgres”);

Told you it was something dumb…thanks for pointing me in the right direction!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.