twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
Other
23.11k stars 2.41k forks source link

PostgreSQL Password with Special Characters Leads to isUrl Validation Failure #8597

Closed Taldres closed 1 day ago

Taldres commented 2 days ago

Bug Description

I assigned a custom password to the PostgreSQL user and added it to the PG_DATABASE_URL. However, the password contained special characters like = and /, which seemingly caused the isUrl validation to fail.

After choosing an alphanumeric password, it worked perfectly.

If this bug can be confirmed, it would certainly be beneficial to include this note in the documentation until it is resolved.

Expected behavior

Special characters should be allowed.

Technical inputs

Errors

worker-1  | Error: An instance of EnvironmentVariables has failed the validation:
worker-1  |  - property PG_DATABASE_URL has failed the following constraints: isUrl
server-1  | Error: An instance of EnvironmentVariables has failed the validation:
server-1  |  - property PG_DATABASE_URL has failed the following constraints: isUrl 

Code isUrl Validation

FelixMalfait commented 1 day ago

Hey, thanks for the report!

It uses validator.js under the hood which has the following options: https://github.com/validatorjs/validator.js

Image

So I'm not sure there's anything we can do on our side. If we remove validation then it could break later during the parsing step and be even harder to debug.

Maybe try percent encoding? https://stackoverflow.com/questions/23353623/how-to-handle-special-characters-in-the-password-of-a-postgresql-url-connection I guess that should work!