Escaping characters in database url variable #358

Open
opened 2025-10-09 18:45:00 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @kalxasus on GitHub.

I trying run planka with variable:

DATABASE_URL=postgresql://planka:aeN=oongee\T8gie@172.172.172.222:5432/planka

And on start get this error:

2024-04-11 06:45:16 [E] A hook (`orm`) failed to load!
2024-04-11 06:45:16 [E] Failed to lift app: `getConnection` failed ("failed").  Could not acquire a connection to the database using the specified manager.
Additional data:

{
  error: Error: connect ECONNREFUSED 172.31.0.2:5432
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
    errno: -111,
    code: 'ECONNREFUSED',
    syscall: 'connect',
    address: '172.31.0.2',
    port: 5432
  },
  meta: undefined
}
2024-04-11 06:45:16 [E] More details (raw):

I was confusing by this message, why his try connect to internal container IP address. And in a same time on every try starting container, in postgresql created db structure and seen error in postgresql log:
ERROR: conflicting key value violates exclusion constraint "user_email_unique"

when service try to create admin user in DB.

I spent a lot of time, to try run service via helm or docker-compose before I understood that problem in character \ in connection password.

Originally created by @kalxasus on GitHub. I trying run planka with variable: ``` DATABASE_URL=postgresql://planka:aeN=oongee\T8gie@172.172.172.222:5432/planka ``` And on start get this error: ``` 2024-04-11 06:45:16 [E] A hook (`orm`) failed to load! 2024-04-11 06:45:16 [E] Failed to lift app: `getConnection` failed ("failed"). Could not acquire a connection to the database using the specified manager. Additional data: { error: Error: connect ECONNREFUSED 172.31.0.2:5432 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '172.31.0.2', port: 5432 }, meta: undefined } 2024-04-11 06:45:16 [E] More details (raw): ``` I was confusing by this message, why his try connect to internal container IP address. And in a same time on every try starting container, in postgresql created db structure and seen error in postgresql log: `ERROR: conflicting key value violates exclusion constraint "user_email_unique"` when service try to create admin user in DB. I spent a lot of time, to try run service via helm or docker-compose before I understood that problem in character `\` in connection password.
OVERLORD added the bug label 2025-10-09 18:45:00 +03:00
Author
Owner

@gelomon commented on GitHub:

I have been experiencing this issue and what I have done is to adjust the postgres healthcheck from 10s to 20s to give additional time.

With original values, my instance is logging this same issue ECONNREFUSED , but the difference is I am using docker

@gelomon commented on GitHub: I have been experiencing this issue and what I have done is to adjust the postgres healthcheck from 10s to 20s to give additional time. With original values, my instance is logging this same issue **ECONNREFUSED** , but the difference is I am using docker
Author
Owner

@meltyshev commented on GitHub:

Hi! Thanks for reporting this.

I don't understand how to fix this yet, it seems that the adapter doesn't connect if there is a backslash in DATABASE_URL (even if escaped), for some reason it automatically replaces it with a normal slash when connecting. The only way to get around this quickly is to not use them in DATABASE_URL.

And in a same time on every try starting container, in postgresql created db structure and seen error in postgresql log:
ERROR: conflicting key value violates exclusion constraint "user_email_unique"
when service try to create admin user in DB.

This is the correct behavior, it tries to create an administrator on startup every time (in case it's suddenly deleted). Seems like we should hide this message because it's confusing.

@meltyshev commented on GitHub: Hi! Thanks for reporting this. I don't understand how to fix this yet, it seems that the adapter doesn't connect if there is a backslash in `DATABASE_URL` (even if escaped), for some reason it automatically replaces it with a normal slash when connecting. The only way to get around this quickly is to not use them in `DATABASE_URL`. > And in a same time on every try starting container, in postgresql created db structure and seen error in postgresql log: `ERROR: conflicting key value violates exclusion constraint "user_email_unique"` when service try to create admin user in DB. This is the correct behavior, it tries to create an administrator on startup every time (in case it's suddenly deleted). Seems like we should hide this message because it's confusing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#358