Describe the bug
I was looking through the mikro-orm docs and noticed that they say you can pass in the connection string as 'clientUrl' inside mikroOrmConfig.
So I set that up thinking I could get rid of the custom url parsing script:
export const getConnection = () => ({
connectionManagerId: 'postgresql',
mikroOrmConfig: {
driverOptions: {
connection: process.env.NODE_ENV === 'development' ? {} : { ssl: { rejectUnauthorized: false } },
},
entities: [...entities],
clientUrl: process.env.DATABASE_URL, // postgresql://postgres:postgres@127.0.0.1:5432/[database name]
driver: PostgreSqlDriver,
pool: { min: 2, max: 50 },
},
});
However, when I ran a simple query to list all organizations, I got this error :
{
"errors": [
{
"extensions": {
"code": "INTERNAL_SERVER_ERROR"
},
"message": "select distinct \"o0\".* from \"organizations\" as \"o0\" - relation \"organizations\" does not exist",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"organizations"
],
"context": {
"message": "select distinct \"o0\".* from \"organizations\" as \"o0\" - relation \"organizations\" does not exist",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"organizations"
]
}
}
],
"data": {
"organizations": null
}
}
API Error Message:
error: select distinct "o0".* from "organizations" as "o0" where "o0"."name" = 'cold-climate-development' order by "o0"."id" desc limit 1 - relation "organizations" does not exist
at Parser.parseErrorMessage ([project root]node_modules/.pnpm/pg-protocol@1.6.1/node_modules/pg-protocol/dist/parser.js:283:98)
at Parser.handlePacket ([project root]node_modules/.pnpm/pg-protocol@1.6.1/node_modules/pg-protocol/dist/parser.js:122:29)
at Parser.parse ([project root]node_modules/.pnpm/pg-protocol@1.6.1/node_modules/pg-protocol/dist/parser.js:35:38)
at Socket.<anonymous> ([project root]node_modules/.pnpm/pg-protocol@1.6.1/node_modules/pg-protocol/dist/index.js:11:42)
at Socket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:376:12)
at readableAddChunk (node:internal/streams/readable:349:9)
at Readable.push (node:internal/streams/readable:286:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17)
From the error log, you would think the requested org doesn't exist especially since the error is thrown when addUserToContext() attempts to get an organization by name.
const org = await provider.findOne({name: 'cold-climate-development'});
But if I revert the change in mikroOrmConfig to go back to using my custom script to parse the URL to extract the database connection values,
mikroOrmConfig: {
driverOptions: {
connection: process.env.NODE_ENV === 'development' ? {} : { ssl: { rejectUnauthorized: false } },
},
entities: [...entities],
...connectionValues(),
driver: PostgreSqlDriver,
pool: { min: 2, max: 50 },
}
then running the same query again works (notice 'cold-climate-development' exists)
{
"data": {
"organizations": [
{
"name": "fritsch-green-and-harber-llc",
"id": "org_1RR1lEozCMv6yHMs"
},
{
"name": "cold-climate-development",
"id": "org_liq0Z0GHUJ044liS"
}
]
}
}
I realize this is possibly due to a bug in mikro-orm's parsing of the URL but just wanted to alert you to another example of the logging issue.
To Reproduce
Configure the MikroORM adapter with a clientUrl.
Expected behavior
Connection works, or a clear error message is created.
Actual behavior
pg says relation doesn't exist.
Additional context
https://graphweaver.slack.com/archives/D0730MYM74Z/p1726178289691349?thread_ts=1723672001.215299&cid=D0730MYM74Z
Describe the bug
I was looking through the mikro-orm docs and noticed that they say you can pass in the connection string as 'clientUrl' inside mikroOrmConfig.
So I set that up thinking I could get rid of the custom url parsing script:
However, when I ran a simple query to list all organizations, I got this error :
{ "errors": [ { "extensions": { "code": "INTERNAL_SERVER_ERROR" }, "message": "select distinct \"o0\".* from \"organizations\" as \"o0\" - relation \"organizations\" does not exist", "locations": [ { "line": 2, "column": 5 } ], "path": [ "organizations" ], "context": { "message": "select distinct \"o0\".* from \"organizations\" as \"o0\" - relation \"organizations\" does not exist", "locations": [ { "line": 2, "column": 5 } ], "path": [ "organizations" ] } } ], "data": { "organizations": null } }API Error Message:
From the error log, you would think the requested org doesn't exist especially since the error is thrown when
addUserToContext()attempts to get an organization by name.But if I revert the change in mikroOrmConfig to go back to using my custom script to parse the URL to extract the database connection values,
then running the same query again works (notice 'cold-climate-development' exists)
{ "data": { "organizations": [ { "name": "fritsch-green-and-harber-llc", "id": "org_1RR1lEozCMv6yHMs" }, { "name": "cold-climate-development", "id": "org_liq0Z0GHUJ044liS" } ] } }I realize this is possibly due to a bug in mikro-orm's parsing of the URL but just wanted to alert you to another example of the logging issue.
To Reproduce
Configure the MikroORM adapter with a
clientUrl.Expected behavior
Connection works, or a clear error message is created.
Actual behavior
pgsays relation doesn't exist.Additional context
https://graphweaver.slack.com/archives/D0730MYM74Z/p1726178289691349?thread_ts=1723672001.215299&cid=D0730MYM74Z