The problem is likely to be the # in he password. If you look at the definition of a url
(see https://en.wikipedia.org/wiki/URL for example)
URI = scheme:[//authority]path[?query][#fragment]
authority = [userinfo@]host[:port]
If you look at how the url parser interprets that url
with some code like:
const url = require('url');
const parsed = url.parse('postgres://someuser:pas#%w#@rd-some-db.cgosdsd8op.us-east-1.rds.amazonaws.com:5432');
console.log(parsed);
you will get some output like:
Url {
protocol: 'postgres:',
slashes: true,
auth: null,
host: 'someuser',
port: null,
hostname: 'someuser',
hash: '#%w#@rd-some-db.cgosdsd8op.us-east-1.rds.amazonaws.com:5432',
search: null,
query: null,
pathname: '/:pas',
path: '/:pas',
href: 'postgres://someuser/:pas#%w#@rd-some-db.cgosdsd8op.us-east-1.rds.amazonaws.com:5432' }
The error you get is because the auth element returns null
if you urlencode the username and password
so the url becomes
'postgres://someuser%3Apas%23%25w%23@some-db.cgosdsd8op.us-east-1.rds.amazonaws.com:5432'
you can see the output is correctly parsed
Url {
protocol: 'postgres:',
slashes: true,
auth: 'someuser:pas#%w#',
host: 'some-db.cgosdsd8op.us-east-1.rds.amazonaws.com:5432',
port: '5432',
hostname: 'some-db.cgosdsd8op.us-east-1.rds.amazonaws.com',
hash: null,
search: null,
query: null,
pathname: null,
path: null,
href: 'postgres://someuser:pas%23%25w%23@some-db.cgosdsd8op.us-east-1.rds.amazonaws.com:5432' }