cli icon indicating copy to clipboard operation
cli copied to clipboard

generating typescript type fails when there is certain special chars in password

Open pixtron opened this issue 3 years ago • 0 comments

Bug report

Describe the bug

I tried to run this command:

supabase gen types typescript --db-url 'postgres://postgres:[YOUR_PASSWORD]@db.[YOUR_REF].supabase.co:6543/postgres' > types.ts

The password contained the special chars $, # and %. The command failed with

Error: node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Object>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Did some further tests:

  • $, % in password work
  • #, ? in password does not work

To Reproduce

See above.

Expected behavior

Should work with any special char.

System information

  • OS: macOS
  • Version of supabase-cli: 1.0.1

Additional context

The error is probably thrown in this async method and never caught. https://github.com/supabase/postgres-meta/blob/32da58fb3e18d21bd15ab423bb04a0267275d8ea/src/server/app.ts#L62-L65

pixtron avatar Aug 16 '22 18:08 pixtron