URIError: URI malformed | special characters aren't accepted
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
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 to a-zA-Z0-9. What do you think about expanding to more characters in order to make the password more secure?
!@#$%^&*, ()-_+=[]{}:;'".<>/\|~?`
Error
$ bun admin/src/be.ts
543 | const urlObj = new URL(url.replace(host, host.split(',')[0]))
544 |
545 | return {
546 | url: {
547 | username: decodeURIComponent(urlObj.username),
548 | password: decodeURIComponent(urlObj.password),
^
URIError: URI error
at parseUrl (/home/dl/virtum.club/node_modules/postgres/src/index.js:548:16)
at parseOptions (/home/dl/virtum.club/node_modules/postgres/src/index.js:435:29)
at Postgres (/home/dl/virtum.club/node_modules/postgres/src/index.js:50:18)
at /home/dl/virtum.club/admin/src/be.ts:11:15
Usage
// admin/src/be.ts
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
export const notes = pgTable('note', {
id: serial('id').primaryKey(),
note: text('note').notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
const client = postgres(process.env['DATABASE_URL']!);
const db = drizzle(client);
(async () => {
console.log(await db.select().from(notes));
})();
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure using the DATABASE_URL example from admin/src/be.ts, then inspect parseUrl around node_modules/postgres/src/index.js:547-548, where the URIError occurs while decoding credentials. Done means the client can connect when the password contains the listed special characters without producing this error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100