synth icon indicating copy to clipboard operation
synth copied to clipboard

Possible bug parsing `--from` arg.

Open nbrr opened this issue 2 years ago • 0 comments

Describe the bug Synth seems to have issues parsing the password for the database.

To Reproduce

The following command resulted in an error I didn't expect:

$ synth import my_namespace --from "$DATABASE_URL" --schema my_schema
Error: Parsing import URI 'postgres://my_user:my_pass__wo#[email protected]/my_db'

Caused by:
    invalid port character

Here, DATABASE_URL=postgres://my_user:my_pass__wo#[email protected]/my_db, the key point being I believe the _, __, and # characters in the password (otherwise obfuscated in this example).

$ synth import my_base --from "$DATABASE_URL" --schema my_schema
Error: error returned from database: password authentication failed for user "my_user"

Caused by:
    password authentication failed for user "my_user"

In this second example, the only difference is that the password only contains alphabetical and number characters (and is wrong). When I set the password without special characters to be the right one, the command executes successfully.

Expected behavior Command to execute successfully.

Environment (please complete the following information): nix-shell with synth provided by the following overlay (which is basically that provided by synth):

let
  ref = "refs/tags/v0.6.5-r1";
  rev = "b870659fbba07f6831f2af92e1884862c71f9e69";
  synthSrc = builtins.fetchGit {
    url = "https://github.com/getsynth/synth.git";
    inherit ref rev;
  };
in
self: super: {
  synth = (import "${synthSrc}/nix/release.nix" {}).override { inherit synthSrc; };
}

Additional context Note that diesel is happy with my DATABASE_URL environment variable.

nbrr avatar Apr 14 '22 20:04 nbrr