You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using a CockroachDB instance. According to the knex/pg documentation, this is fully supported, however, we've noticed that this isn't supported in Medusa v2, due to a lack of configuration options.
I've noticed this while trying to migrate when connecting to a CockroachDB instance, which will give me the following error message,
2024-10-16T09:59:02.163050316Z {"level":"info","message":"Running migrations...","timestamp":"2024-10-16 09:59:02"}
TypeError: Cannot read properties of null (reading '1')
2024-10-16T09:59:04.197823482Z at Client_PG._parseVersion (/app/node_modules/knex/lib/dialects/postgres/index.js:135:56)
2024-10-16T09:59:04.197829289Z at Query.<anonymous> (/app/node_modules/knex/lib/dialects/postgres/index.js:129:22)
2024-10-16T09:59:04.197834335Z at Query.handleReadyForQuery (/app/node_modules/pg/lib/query.js:142:14)
2024-10-16T09:59:04.197837829Z at Client._handleReadyForQuery (/app/node_modules/pg/lib/client.js:311:19)
2024-10-16T09:59:04.197841895Z at Connection.emit (node:events:519:28)
2024-10-16T09:59:04.197846509Z at Connection.emit (node:domain:488:12)
2024-10-16T09:59:04.197849865Z at /app/node_modules/pg/lib/connection.js:116:12
2024-10-16T09:59:04.197853012Z at Parser.parse (/app/node_modules/pg-protocol/src/parser.ts:103:9)
2024-10-16T09:59:04.197856679Z at TLSSocket.<anonymous> (/app/node_modules/pg-protocol/src/index.ts:7:48)
While digging around on the map, we've found that this TypeError is specifically related to using CockroachDB and that the solution is to either change the client to cockroachdb or to add a version to the Knex configuration (see Knex issue 2892, Knex issue 1477).
This isn't currently possible in the latest Medusa v2 codebase (ref). Unfortunately there is no way for us to change our database, so this is quite an issue for us.
Change the .env file with the correct variables, postgres://{user}:{password}@{cockroach_ip}:{cockroach_port}/{database}
Migrate the database
You should be greeted with the TypeError: Cannot read properties of null (reading '1') error.
Expected behavior
Medusa should allow us to supply additional options to the Knex/pg configuration so that anybody is able to connect to any Knex/pg supported databases and migrate.
Additional context
We think the solution is to either allow us to change the client or to supply any additional arguments (i.e. version) to the Knex instance (ref), e.g.
Bug report
Describe the bug
We are using a CockroachDB instance. According to the knex/pg documentation, this is fully supported, however, we've noticed that this isn't supported in Medusa v2, due to a lack of configuration options.
I've noticed this while trying to migrate when connecting to a CockroachDB instance, which will give me the following error message,
While digging around on the map, we've found that this TypeError is specifically related to using CockroachDB and that the solution is to either change the client to
cockroachdb
or to add a version to the Knex configuration (see Knex issue 2892, Knex issue 1477).This isn't currently possible in the latest Medusa v2 codebase (ref). Unfortunately there is no way for us to change our database, so this is quite an issue for us.
System information
Medusa version (including plugins): rc / v2.0.10
Node.js version: 20
Database: Cockroachdb v23.1.28
Operating system: macOs 15.0
Steps to reproduce the behavior
postgres://{user}:{password}@{cockroach_ip}:{cockroach_port}/{database}
TypeError: Cannot read properties of null (reading '1')
error.Expected behavior
Medusa should allow us to supply additional options to the Knex/pg configuration so that anybody is able to connect to any Knex/pg supported databases and migrate.
Additional context
We think the solution is to either allow us to change the client or to supply any additional arguments (i.e.
version
) to the Knex instance (ref), e.g.The text was updated successfully, but these errors were encountered: