rapid-shampoo-76081
05/10/2023, 1:02 PMshuttle_secrets
?
snippet:
#[async_trait]
impl EventHandler for Handler {
async fn ready(&self,
ctx: Context, ready: Ready) {
let secret_var = if let Some(token) = secret_store.get("SECRET_VAR") {
token
} else {
return Err(anyhow!("'SECRET_VAR' was not found").into());
};
}
}
#[shuttle_runtime::main]
async fn serenity(
#[shuttle_secrets::Secrets] secret_store: SecretStore,
) -> shuttle_serenity::ShuttleSerenity {
Ok(client.into())
}
agreeable-parrot-72483
05/10/2023, 3:33 PMerror[E0277]: the trait bound `SalvoService: From<Router>` is not satisfied
--> src/main.rs:14:15
|
14 | Ok(router.into())
| ^^^^ the trait `From<Router>` is not implemented for `SalvoService`
|
= help: the trait `From<salvo_core::routing::router::Router>` is implemented for `SalvoService`
= note: required for `Router` to implement `Into<SalvoService>`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `simplicity` due to previous error
I haven't yet changed anything in the project.
Thanks in advance! šbulky-arm-3861
05/10/2023, 5:14 PMhttps://cdn.discordapp.com/attachments/1105905804831379637/1105905805368246352/image.pngā¾
careful-flag-68889
05/13/2023, 6:43 AMrust
use std::path::PathBuf;
use axum::{routing::get, Router};
use axum_extra::routing::SpaRouter;
async fn hello_world() -> &'static str {
"Hello, world!"
}
#[shuttle_runtime::main]
async fn axum(
// Name your static assets folder by passing `folder = <name>` to `StaticFolder`
// If you don't pass a name, it will default to `static`.
#[shuttle_static_folder::StaticFolder(folder = "assets")] static_folder: PathBuf,
) -> shuttle_axum::ShuttleAxum {
let router = Router::new()
.route("/hello", get(hello_world))
.merge(SpaRouter::new("/assets", static_folder).index_file("index.html"));
Ok(router.into())
}
Error:
2023-05-13T08:39:12.639700265Z DEBUG error[E0432]: unresolved import `axum_extra::routing::SpaRouter`
--> src/main.rs:4:5
|
4 | use axum_extra::routing::SpaRouter;
| ^^^^^^^^^^^^^^^^^^^^^---------
| | |
| | help: a similar name exists in the module: `Router`
| no `SpaRouter` in `routing`
2023-05-13T08:39:12.671257094Z DEBUG error[E0599]: no function or associated item named `new` found for struct `StaticFolder` in the current scope
--> src/main.rs:10:1
|
10 | #[shuttle_runtime::main]
| ^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `StaticFolder<'_>`
|
= help: items from traits can only be used if the trait is in scope
= note: this error originates in the attribute macro `shuttle_runtime::main` (in Nightly builds, run with -Z macro-backtrace for more info)
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
1 | use shuttle_service::ResourceBuilder;
|
Dependencies:
toml
[dependencies]
shuttle-runtime = "0.14.0"
axum = "0.6.17"
shuttle-axum = "0.14.0"
tokio = "1.28.0"
shuttle-static-folder = "0.16.0"
axum-extra = "0.7.4"
Rust version: rust 1.71.0-nightly
What is causing this?thousands-helicopter-92645
05/13/2023, 4:58 PMcurl -F "file=@Cargo.toml" https://rustypaste.shuttleapp.rs
Internally, are they uploaded inside an isolated container? If so, is there any disk/memory/cpu limits? Is there any documentation about this?
Thank you for this great project!future-motorcycle-74352
05/14/2023, 3:02 AMfuture-motorcycle-74352
05/15/2023, 3:40 AMsquare-baker-38389
05/15/2023, 9:31 AMcargo shuttle run
my project, this program execute youtube-dl
, yt-dlp
and ffmpeg
on my local machine.
How can I do to make my bot work (Cause the server may not have these command)square-baker-38389
05/16/2023, 10:01 AMcargo shuttle init poise
to create a project then just run without any modify, it shows an error
Building /Users/chenchaoting/Documents/Rust/bottt-poise
Finished dev [unoptimized + debuginfo] target(s) in 0.16s
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 48, kind: AddrInUse, message: "Address already in use" }))', /Users/chenchaoting/.cargo/registry/src/github.com-1ecc6299db9ec823/shuttle-runtime-0.16.0/src/alpha/mod.rs:88:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: status: Unknown, message: "transport error", details: [], metadata: MetadataMap { headers: {} }
Caused by:
0: transport error
1: http2 error: stream error received: stream no longer needed
2: stream error received: stream no longer needed', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-shuttle-0.16.0/src/lib.rs:749:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I get this when using serenity and fix it by setting RUSTUP_TOOLCHAIN 1.68
but when migrating from serenity to poise, this get me an error.enough-exabyte-92081
05/16/2023, 7:35 PM...
2023-05-16T21:27:44.448632133Z DEBUG hyper::client::connect::http: connecting to 127.0.0.1:18971
2023-05-16T21:27:44.451173177Z DEBUG hyper::client::connect::http: connected to 127.0.0.1:18971
2023-05-16T21:27:44.453423195Z DEBUG {service.ready=true} tower::buffer::worker: processing request
2023-05-16T21:27:44.456117210Z INFO shuttle_deployer::deployment::run: loading project from: /opt/shuttle/shuttle-executables/1861aef5-6744-4fee-bbc2-958b0ec05057
2023-05-16T21:27:44.458121686Z DEBUG shuttle_deployer::deployment::run: loading service
2023-05-16T21:27:44.460324723Z DEBUG {service.ready=true} tower::buffer::worker: processing request
Deployment has not entered the running state
And this is my code:
rust
#[shuttle_runtime::main]
async fn actix_web(
#[shuttle_shared_db::Postgres] pool: sqlx::PgPool,
#[shuttle_secrets::Secrets] secret_store: shuttle_secrets::SecretStore,
#[shuttle_static_folder::StaticFolder(folder = "templates")] static_folder: std::path::PathBuf,
) -> ShuttleActixWeb<impl FnOnce(&mut ServiceConfig) + Send + Clone + 'static> {
pool.execute("CREATE EXTENSION IF NOT EXISTS pgcrypto")
.await
.context("cannot create required extension")?;
sqlx::migrate!()
.run(&pool)
.await
.context("cannot generate migrations")?;
let secret = secret_store
.get("COOKIE_SECRET")
.context("secret was not found")?;
........
I see logs for the extension, but no for the migration. However there are no errors.
Any idea why it's failing?nice-lamp-80603
05/17/2023, 11:49 AMastonishing-tent-55899
05/18/2023, 8:00 AMrough-printer-11429
05/19/2023, 11:24 AMhttps://cdn.discordapp.com/attachments/1109079151765372978/1109079152029610034/image.pngā¾
average-grass-72372
05/20/2023, 10:49 AMrm
for cargo shuttle project
great-insurance-57704
05/20/2023, 12:09 PM2023-05-20T13:52:58.545699474Z INFO Compiling ticklist v0.1.0 (/opt/shuttle/shuttle-builds/ticklist)
2023-05-20T13:52:58.757461205Z DEBUG error[E0599]: no function or associated item named `now_v7` found for struct `Uuid` in the current scope
--> src/main.rs:99:21
|
99 | .bind(Uuid::now_v7())
| ^^^^^^
| |
| function or associated item not found in `Uuid`
| help: there is an associated function with a similar name: `new_v4`
2023-05-20T13:52:58.762462429Z DEBUG error[E0599]: no function or associated item named `now_v7` found for struct `Uuid` in the current scope
--> src/main.rs:123:21
|
123 | .bind(Uuid::now_v7())
| ^^^^^^
| |
| function or associated item not found in `Uuid`
| help: there is an associated function with a similar name: `new_v4`
2023-05-20T13:52:58.769838490Z DEBUG error[E0599]: no function or associated item named `now_v7` found for struct `Uuid` in the current scope
--> src/main.rs:148:21
|
148 | .bind(Uuid::now_v7())
| ^^^^^^
| |
| function or associated item not found in `Uuid`
| help: there is an associated function with a similar name: `new_v4`
2023-05-20T13:52:58.784627003Z DEBUG error: aborting due to 3 previous errors
I assume that the custom rustflags are not picked up.icy-tent-39655
05/23/2023, 9:54 AMwonderful-forest-43220
05/23/2023, 11:00 AMcargo-shuttle
for Void Linux, when running cargo shuttle login
I'm sent to the github login page, after logging in I get the dashboard, but I don't see API key anywhere.
More details:
I'm running Void Linux, but on WSL2, relying on https://github.com/wslutilities/wslu to open links in the browser on Windows (Firefox in my case).late-sandwich-93145
05/25/2023, 10:36 AMgentle-agency-53651
05/25/2023, 10:58 AMrust
use rocket::{fairing::AdHoc, Rocket, Build};
use rocket_sync_db_pools::diesel;
use crate::diesel_migrations::{MigrationHarness, EmbeddedMigrations};
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("db/migrations");
#[database("db")]
pub struct Db(diesel::PgConnection);
async fn run_migrations(rocket: Rocket<Build>) -> Rocket<Build> {
let conn = Db::get_one(&rocket).await.expect("database connection");
conn.run(|c| { c.run_pending_migrations(MIGRATIONS).unwrap(); }).await;
rocket
}
pub(crate) fn stage() -> AdHoc {
AdHoc::on_ignite("Diesel Postgres Stage", |rocket| async {
rocket.attach(Db::fairing())
.attach(AdHoc::on_ignite("Diesel Migrations", run_migrations))
})
}
astonishing-laptop-19143
05/25/2023, 6:30 PMshuttle_static_folder::StaticFolder
I receive some errors.
Here is my main function along with the error I'm receiving. It works when I run it using cargo shuttle run but doesn't seem to be able to deploy.
#[shuttle_runtime::main]
async fn start(
#[shuttle_secrets::Secrets] secret_store: SecretStore,
#[shuttle_static_folder::StaticFolder(folder = "static")] _static_folder: PathBuf
) -> Result<CustomService, shuttle_service::Error> {
let discord_bot = bot::build_bot(secret_store).await?;
let built_rocket = rocket::build();
Ok(CustomService {
discord_bot,
built_rocket,
})
}
https://cdn.discordapp.com/attachments/1111360713752059905/1111360713882079273/image.pngā¾
https://cdn.discordapp.com/attachments/1111360713752059905/1111360714217635970/image.pngā¾
careful-iron-7275
05/26/2023, 4:50 PMcargo install cargo-shuttle
, I get the following compile error:
error[E0308]: mismatched types
--> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/shuttle-common-0.17.0/src/models/error.rs:27:43
|
27 | self.message.to_string().with(Color::Red)
| ---- ^^^^^^^^^^ expected `crossterm::style::Color`, found `comfy_table::Color` | |
| arguments to this method are incorrect
|
= note: `comfy_table::Color` and `crossterm::style::Color` have similar names, but are actually distinct types
note: `comfy_table::Color` is defined in crate `crossterm`
--> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/crossterm-0.26.1/src/style/types/color.rs:28:1
|
28 | pub enum Color {
| ^^^^^^^^^^^^^^
note: `crossterm::style::Color` is defined in crate `crossterm`
--> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/crossterm-0.25.0/src/style/types/color.rs:28:1
|
28 | pub enum Color {
| ^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `crossterm` are being used?
note: method defined here
--> /home/glitch/.cargo/registry/src/github.com-1ecc6299db9ec823/crossterm-0.25.0/src/style/stylize.rs:78:8
|
78 | fn with(self, color: Color) -> Self::Styled {
melodic-battery-60890
05/26/2023, 6:04 PMgentle-ice-1561
05/26/2023, 9:43 PM2023-05-26T23:26:56.666730297Z INFO Entering building state
2023-05-26T23:26:59.879154060Z INFO Updating `shuttle-crates-io-mirror` index
2023-05-26T23:26:59.994664332Z INFO Updating git repository `https://github.com/Brendonovich/prisma-client-rust`
2023-05-26T23:27:01.059305833Z INFO Updating git repository `https://github.com/serenity-rs/serenity`
2023-05-26T23:27:04.091984054Z INFO Entering crashed state
2023-05-26T23:27:04.092030797Z ERROR {error="Build error: failed to get `serenity` as a dependency of package `wallace-minion v0.10.8 (/opt/shuttle/shuttle-builds/wallace-minion)`"} shuttle_deployer::deployment::queue: service build encountered an error
astonishing-kitchen-45713
05/27/2023, 3:57 PMcargo shuttle run
I get
log
2023-05-27T15:40:20.574720Z ERROR cargo_shuttle::provisioner_server: got unexpected error while inspecting docker container: error trying to connect: The system cannot find the file specified. (os error 2)
2023-05-27T15:40:20.576845Z ERROR cargo_shuttle: failed to load your service error="Custom error: failed to provision shuttle_shared_db :: Postgres"
Subsequent attempts each get
log
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 10048, kind: AddrInUse, message: "Only one usage of each socket address (protocol/network address/port) is normally permitted." }))', C:\Users\<name>\.cargo\registry\src\github.com-1ecc6299db9ec823\shuttle-runtime-0.14.0\src\alpha\mod.rs:88:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: status: PermissionDenied, message: "Access is denied. (os error 5)", details: [], metadata: MetadataMap { headers: {} }
I did try updating to 0.17.0
but then I can't even build as I get a
log
note: LINK : fatal error LNK1104: cannot open file '<path to my discord bot .exe>'
so wasn't sure which to tackle first (or how)mammoth-cpu-45372
05/27/2023, 11:46 PMicy-musician-50528
05/28/2023, 9:54 AM2023-05-28T12:32:08.415508031Z INFO Entering loading state
2023-05-28T12:32:08.420443815Z TRACE shuttle_deployer::runtime_manager: making new client
2023-05-28T12:32:08.425105327Z DEBUG shuttle_deployer::runtime_manager: Starting alpha runtime at: /opt/shuttle/shuttle-executables/d3ea025d-fe4e-4972-a4b4-f0fe6d261912
2023-05-28T12:32:10.428831483Z INFO shuttle_proto::runtime: connecting runtime client
2023-05-28T12:32:10.428925119Z DEBUG hyper::client::connect::http: connecting to 127.0.0.1:19498
2023-05-28T12:32:10.431664770Z DEBUG hyper::client::connect::http: connected to 127.0.0.1:19498
2023-05-28T12:32:10.434448027Z DEBUG {service.ready=true} tower::buffer::worker: processing request
2023-05-28T12:32:10.437625123Z INFO shuttle_deployer::deployment::run: loading project from: /opt/shuttle/shuttle-executables/d3ea025d-fe4e-4972-a4b4-f0fe6d261912
2023-05-28T12:32:10.441717466Z DEBUG shuttle_deployer::deployment::run: loading service
In case it does matter, the way migrations were run were changed from this:
rust
db.execute(include_str!("../schema.sql")).await.unwrap();
to this:
rust
static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!();
#[shuttle_runtime::main]
async fn init(
#[shuttle_shared_db::Postgres]
db: sqlx::PgPool,
#[shuttle_secrets::Secrets] secrets: shuttle_secrets::SecretStore,
) -> Result<CustomService, shuttle_runtime::Error> {
...
MIGRATOR
.run(&db)
.await
.map_err(|e| CustomError::new(e).context("Failed to apply migrations"))?;
...
}
refined-receptionist-71124
05/28/2023, 11:06 AMrs
#[shuttle_runtime::main]
async fn rocket(
#[shuttle_aws_rds::Postgres()]
pool: PgPool,
) -> shuttle_rocket::ShuttleRocket {
pool.execute(include_str!("../schema.sql"))
.await
.map_err(CustomError::new)?;
let state = MyState { pool: pool };
let rocket = rocket::build()
.mount("/v1.0", routes![outages, _area_search])
.mount("/esp/2.0", routes![esp_index, esp_status])
.manage(state);
Ok(rocket.into())
}
I have docker and postgresql installed, but I haven't set anything up besides starting a postgres server. The docs aren't super clear about if any setup is needed?
When I try to run locally with cargo shuttle run
, I get:
Finished dev [unoptimized + debuginfo] target(s) in 4.51s
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: tonic::transport::Error(Transport, hyper::Error(Listen, Os { code: 48, kind: AddrInUse, message: "Address already in use" }))', /Users/brk/.cargo/registry/src/github.com-1ecc6299db9ec823/shuttle-runtime-0.17.0/src/alpha/mod.rs:87:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error: status: Internal, message: "failed to connect to provisioner", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Sun, 28 May 2023 10:57:47 GMT", "content-length": "0"} }
Which looks like it's either not provisioning a DB (but the whole idea is that this should be automatic, right?) or the address it's trying to use is in use (But I'm not sure what by?).
Could someone point me in the right direction?sparse-lamp-74430
05/28/2023, 11:09 AMincalculable-addition-83746
05/28/2023, 5:20 PMError: Custom { kind: Other, error: "protoc failed: google/protobuf/timestamp.proto: File not found.\nruntime.proto:4:1: Import \"google/protobuf/timestamp.proto\" was not found or had errors.\nruntime.proto:87:3: \"google.protobuf.Timestamp\" is not defined.\n" }
Before you ask, I do have protoc installed:
⯠protoc --version
libprotoc 3.19.6
gentle-policeman-58466
05/29/2023, 1:19 AMCallback handler failed. CAUSE: Missing state cookie from login request (check login URL, callback URL and cookie config).
have tried different browsers, devices and cleared cookies with no avail.
same as in this issue, but i cannot get access to the dashboard unlike the op
https://github.com/shuttle-hq/shuttle/issues/697