Fails to start the app #78

Open
opened 2025-09-16 18:50:28 +00:00 by nsunami · 3 comments

I tried to run the app on my machine, but it did not work. Opening an issue here to (1) ask for tips for how to proceed and (2) document progress.

What I did

nix-shell
cargo run

Output

warning: unused import: `crate::auth::authorization::Authorizable`
 --> src/models/invitation.rs:6:5
  |
6 | use crate::auth::authorization::Authorizable;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: use of deprecated function `base64::encode`: Use Engine::encode
  --> src/auth/otp_login_token.rs:28:31
   |
28 |     let payload_b64 = base64::encode(&payload);
   |                               ^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: use of deprecated function `base64::encode`: Use Engine::encode
  --> src/auth/otp_login_token.rs:32:29
   |
32 |     let signature = base64::encode(mac.finalize().into_bytes());
   |                             ^^^^^^

warning: use of deprecated function `base64::encode`: Use Engine::encode
  --> src/auth/otp_login_token.rs:53:38
   |
53 |     let expected_signature = base64::encode(mac.finalize().into_bytes());
   |                                      ^^^^^^

warning: use of deprecated function `base64::decode`: Use Engine::decode
  --> src/auth/otp_login_token.rs:60:27
   |
60 |     let payload = base64::decode(payload_b64)?;
   |                           ^^^^^^

warning: unused variable: `claims`
  --> src/auth/invitation.rs:27:5
   |
27 |     claims: web::ReqData<Claims>,
   |     ^^^^^^ help: if this is intentional, prefix it with an underscore: `_claims`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: `researchequals-api` (lib) generated 6 warnings (run `cargo fix --lib -p researchequals-api` to apply 1 suggestion)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.38s
     Running `target/debug/researchequals-api`

thread 'main' panicked at src/lib.rs:29:10:
Failed to create pool: Error(Some("Can't connect to server on '127.0.0.1' (36)"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I tried to run the app on my machine, but it did not work. Opening an issue here to (1) ask for tips for how to proceed and (2) document progress. ### What I did ``` nix-shell cargo run ``` ### Output ``` warning: unused import: `crate::auth::authorization::Authorizable` --> src/models/invitation.rs:6:5 | 6 | use crate::auth::authorization::Authorizable; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: use of deprecated function `base64::encode`: Use Engine::encode --> src/auth/otp_login_token.rs:28:31 | 28 | let payload_b64 = base64::encode(&payload); | ^^^^^^ | = note: `#[warn(deprecated)]` on by default warning: use of deprecated function `base64::encode`: Use Engine::encode --> src/auth/otp_login_token.rs:32:29 | 32 | let signature = base64::encode(mac.finalize().into_bytes()); | ^^^^^^ warning: use of deprecated function `base64::encode`: Use Engine::encode --> src/auth/otp_login_token.rs:53:38 | 53 | let expected_signature = base64::encode(mac.finalize().into_bytes()); | ^^^^^^ warning: use of deprecated function `base64::decode`: Use Engine::decode --> src/auth/otp_login_token.rs:60:27 | 60 | let payload = base64::decode(payload_b64)?; | ^^^^^^ warning: unused variable: `claims` --> src/auth/invitation.rs:27:5 | 27 | claims: web::ReqData<Claims>, | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_claims` | = note: `#[warn(unused_variables)]` on by default warning: `researchequals-api` (lib) generated 6 warnings (run `cargo fix --lib -p researchequals-api` to apply 1 suggestion) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.38s Running `target/debug/researchequals-api` thread 'main' panicked at src/lib.rs:29:10: Failed to create pool: Error(Some("Can't connect to server on '127.0.0.1' (36)")) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ```
Owner

All the logs are warnings, so those can be ignored for the purposes of running the app. The core here is:

thread 'main' panicked at src/lib.rs:29:10:
Failed to create pool: Error(Some("Can't connect to server on '127.0.0.1' (36)"))

This refers to src/lib.rs line 29, which handles database connections. Can you verify mysql is running when you do cargo run? It looks like I only added the mysql client to nix, and it currently assumes it is running in the system beforehand. 😊 If you're on macOS it probably needs something like brew install mysql and the instructions it provides to get up and running.

All the logs are warnings, so those can be ignored for the purposes of running the app. The core here is: ```sh thread 'main' panicked at src/lib.rs:29:10: Failed to create pool: Error(Some("Can't connect to server on '127.0.0.1' (36)")) ``` This refers to `src/lib.rs` line 29, which handles database connections. Can you verify `mysql` is running when you do `cargo run`? It looks like I only added the mysql client to nix, and it currently assumes it is running in the system beforehand. 😊 If you're on macOS it probably needs something like `brew install mysql` and the instructions it provides to get up and running.
Author

Thanks for the tip!

I installed mysql and started the service. And now I'm getting an error that the database called "diesel_dev" is not found.

thread 'main' panicked at src/lib.rs:29:10:
Failed to create pool: Error(Some("Unknown database 'diesel_dev'"))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Perhaps a step to initialize the database is needed?

Thanks for the tip! I installed mysql and started the service. And now I'm getting an error that the database called "diesel_dev" is not found. ``` thread 'main' panicked at src/lib.rs:29:10: Failed to create pool: Error(Some("Unknown database 'diesel_dev'")) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` Perhaps a step to initialize the database is needed?
Owner

Ah yes - diesel migration run I believe. 👍 Does that do the trick?

If not, diesel database reset may also work.

Ah yes - `diesel migration run` I believe. 👍 Does that do the trick? If not, `diesel database reset` may also work.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: researchequals/api#78
No description provided.