matrix-org / rust-synapse-compress-state

A tool to compress some state in a Synapse instance's database
https://pypi.org/project/synapse-auto-compressor/
Apache License 2.0
143 stars 33 forks source link

Non-digit characters in port. #14

Open rubo77 opened 4 years ago

rubo77 commented 4 years ago

I get this error when calling

synapse-compress-state -p "postgresql://some-username:localhost/synapse" -r "${room}"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(ConnectParams(StringError("Non-digit characters in port.")))', src/libcore/result.rs:997:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
             at /usr/src/rustc-1.34.2/src/libcore/macros.rs:17
   9: <core::result::Result<T, E>>::unwrap
             at /usr/src/rustc-1.34.2/src/libcore/result.rs:798
  10: synapse_compress_state::database::get_data_from_db
             at src/database.rs:34
  11: synapse_compress_state::main
             at src/main.rs:185
  12: std::rt::lang_start::{{closure}}
             at /usr/src/rustc-1.34.2/src/libstd/rt.rs:64
  13: std::panicking::try::do_call
  14: __rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: std::rt::lang_start
             at /usr/src/rustc-1.34.2/src/libstd/rt.rs:64
  17: main
  18: __libc_start_main
  19: _start
rubo77 commented 4 years ago

I found out, that the login string "some-username:localhost" is interpreted as port. correct would be "some-username@localhost", but now I get a new error:

a password was requested but not provided

sure, but my user has no password, I can login via psql --dbname=synapse without password.

How can I login, if the user has no password?

rubo77 commented 4 years ago

I found out again: I have to create a user and grant access to it:

sudo -u postgres psql --dbname=synapse -c "create user newuser with encrypted password 'mypass';"
sudo -u postgres psql --dbname=synapse -c "grant all privileges on database synapse to newuser;"  

But now I still get an error:

no authorization for relation "state_groups"