Open draylegend opened 11 months ago
you've got the clue in your here:
548 | password: decodeURIComponent(urlObj.password),
^
URIError: URI error
ensure you encode the properties right.
I get the connection string from the process.env['DATABASE_URL']
. Sounds like I need to split up the string and encode the username
and password
, right @porsager?
Oh I see.. I think that ought to already have the necessary characters URI encoded if it's set by supabase.. Can you show a sample of the string you get with the same characters, but moved around as to not reveal the password?
DATABASE_URL="postgresql://postgres:abc%def#ghklMN@db.[SUPABASE-REFERENCE-ID].supabase.co:5432/postgres"
It'd be awesome to just pass the env variable to postgres
function without splitting up/encoding/decoding a connection string
DATABASE_URL="postgresql://postgres:abc%def#ghklMN@db.[SUPABASE-REFERENCE-ID].supabase.co:5432/postgres"
It'd be awesome to just pass the env variable to
postgres
function without splitting up/encoding/decoding a connection string
FWIW, anywhere that you can pass that URI -e.g. to psql
- you can also pass the credential-encoded counterpart.
usage with encoding const sql = postgres(encodeURI(process.env.DATABASE_URL || ""));
helped me
can't connect to supabase using env var
DATABASE_URL="postgresql://postgres:[PASSWORD]@db.[REFERENCE-ID].supabase.co:5432/postgres"
. It fails if the password contains%
,#
and other special characters. Therefore the range of passwords is reduced toa-zA-Z0-9
. What do you think about expanding to more characters in order to make the password more secure?Error
Usage