https://linen.dev logo
Error 503 Service Unavailable
# help
b
Hello, I'm trying to re-deploy an app that was initially deployed two days ago, but I keep getting:
Copy code
Error: 503 Service Unavailable
message: project not ready
This is the command I'm using:
Copy code
cargo shuttle deploy --allow-dirty
Any ideas?
a
maybe try using
cargo shuttle project rm
then
cargo shuttle project new
? failing that, try making a Shuttle.toml file with a "NAME" variable (like in a .env file) then just trying to make a new project and deploying
b
oh
after doing rm and then new
it seems to work
I think
at least I'm not getting service unavailable anymore
thanks a lot!
a
no problem, happy to help
b
so, although I'm not getting that error anymore, I'm getting some errors related to sqlx
Copy code
2022-12-29T21:23:21.946237989Z DEBUG error: error communicating with database: Cannot assign requested address (os error 99)
  --> src/db_service.rs:50:65
   |
50 |                   "broken shovel" | "cancer" | "ace of spades" => sqlx::query_as!(
   |  _________________________________________________________________^
51 | |                     Collectible,
52 | |                     "SELECT * FROM collectibles WHERE LOWER(name) LIKE $1 LIMIT 10",
53 | |                     format!("%{}%", as_str)
54 | |                 )
   | |_________________^
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)


2022-12-29T21:23:21.947401519Z DEBUG error: error communicating with database: Cannot assign requested address (os error 99)
  --> src/db_service.rs:58:25
   |
58 |                   name => sqlx::query_as!(
   |  _________________________^
59 | |                     Collectible,
60 | |                     "SELECT * FROM collectibles WHERE LOWER(name) = $1 LIMIT 10",
61 | |                     name
62 | |                 )
   | |_________________^
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)

2022-12-29T21:23:22.130997427Z DEBUG error: aborting due to 2 previous errors


2022-12-29T21:23:22.146845343Z  INFO error: could not compile `tboibot-6d24817f-65ef-43f7-8d8a-fdb85aad13ee` due to 2 previous errors

Deployment crashed
Run the following for more details

cargo shuttle logs 6d24817f-65ef-43f7-8d8a-fdb85aad13ee
it works locally with cargo shuttle run (although locally I'm connecting to my local postgres db)
but I'm getting that
Copy code
error communicating with database: Cannot assign requested address (os error 99)
when I'm trying to deploy
a
are you using the shuttle_shared_db lib or are you using a connection string to connect?
b
I'm using shuttle_shared_db
only using a connection string when I run it locally
a
what does it say when you run
cargo shuttle logs
? just error 99?
b
Copy code
2022-12-29T22:04:31.901089673Z  INFO Entering queued state
2022-12-29T22:04:31.909466260Z DEBUG hyper::client::pool: reuse idle connection for ("http", gateway:8001)
2022-12-29T22:04:31.929575446Z DEBUG hyper::client::pool: pooling idle connection for ("http", gateway:8001)

2022-12-29T22:04:31.941456917Z  INFO Entering building state
2022-12-29T22:04:32.305755662Z  INFO     Blocking waiting for file lock on package cache
2022-12-29T22:04:40.555796935Z  INFO     Updating `shuttle-crates-io-mirror` index
2022-12-29T22:04:47.376735923Z  INFO warning: Patch `shuttle-aws-rds v0.8.0 (/usr/src/shuttle/resources/aws-rds)` was not used in the crate graph.
2022-12-29T22:04:47.376773555Z  INFO Patch `shuttle-persist v0.8.0 (/usr/src/shuttle/resources/persist)` was not used in the crate graph.
2022-12-29T22:04:47.381769488Z  INFO Patch `shuttle-static-folder v0.8.0 (/usr/src/shuttle/resources/static-folder)` was not used in the crate graph.
2022-12-29T22:04:47.386861095Z  INFO Check that the patched package version and available features are compatible
2022-12-29T22:04:47.391969872Z  INFO with the dependency requirements. If the patch has a different version from
2022-12-29T22:04:47.396941000Z  INFO what is locked in the Cargo.lock file, run `cargo update` to use the new
2022-12-29T22:04:47.402202785Z  INFO version. This may also occur with an optional dependency that is not enabled.
2022-12-29T22:04:47.413254077Z  INFO     Blocking waiting for file lock on package cache
2022-12-29T22:05:00.047845483Z  INFO     Blocking waiting for file lock on build directory
2022-12-29T22:05:43.807093143Z  INFO    Compiling tboibot-7d23ec89-95d8-4bb8-9fae-31547e83663b v0.1.0 (/opt/shuttle/shuttle-builds/tboibot)
2022-12-29T22:05:43.898477744Z DEBUG error: error communicating with database: Cannot assign requested address (os error 99)
  --> src/db_service.rs:50:65
   |
50 |                   "broken shovel" | "cancer" | "ace of spades" => sqlx::query_as!(
   |  _________________________________________________________________^
51 | |                     Collectible,
52 | |                     "SELECT * FROM collectibles WHERE LOWER(name) LIKE $1 LIMIT 10",
53 | |                     format!("%{}%", as_str)
54 | |                 )
   | |_________________^
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)


2022-12-29T22:05:43.899658513Z DEBUG error: error communicating with database: Cannot assign requested address (os error 99)
  --> src/db_service.rs:58:25
   |
58 |                   name => sqlx::query_as!(
   |  _________________________^
59 | |                     Collectible,
60 | |                     "SELECT * FROM collectibles WHERE LOWER(name) = $1 LIMIT 10",
61 | |                     name
62 | |                 )
   | |_________________^
   |
   = note: this error originates in the macro `$crate::sqlx_macros::expand_query` which comes from the expansion of the macro `sqlx::query_as` (in Nightly builds, run with -Z macro-backtrace for more info)


2022-12-29T22:05:43.915467527Z DEBUG warning: unused import: `query_as`
 --> src/db_service.rs:2:12
  |
2 | use sqlx::{query_as, Executor, PgPool};
  |            ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default


2022-12-29T22:05:44.065631902Z DEBUG error: aborting due to 2 previous errors; 1 warning emitted


2022-12-29T22:05:44.077995526Z  INFO error: could not compile `tboibot-7d23ec89-95d8-4bb8-9fae-31547e83663b` due to 3 previous errors; 1 warning emitted

2022-12-29T22:05:44.099585052Z  INFO Entering crashed state
2022-12-29T22:05:44.099712440Z ERROR {error="Build error: 1 job failed"} shuttle_deployer::deployment::queue: service build encountered an error
this is the output
of cargo shuttle logs
k
The SQLx query macros do compile-time checks of the queries against a db, and I believe the database URL won't be available until runtime (and the password will be rotated so it will change). Have you tried offline mode: ?
b
that makes perfect sense
I wasn't aware this was possible, I'll try now and report back
thanks!
yup, works now, thanks a lot!
k
That's great, no problem!
s
Just a heads up: the
rm; new
sequence is probably the best way to solve errors quickly for now. But shuttle should eventually become stable enough so that we don't need this sequence. However, creating a project with a whole new name should be avoided as that means there is a whole class of errors we never look into and therefore never fix
a
I'll keep that in mind then, thanks for the heads up