From a0aee29a2bbddded96fa5d623af3acb9f0ad61dc Mon Sep 17 00:00:00 2001 From: Ayush Jha Date: Wed, 27 Mar 2024 18:38:22 +0545 Subject: [PATCH] Fix bug with app deploy The app was being fetched before the new versionw as published. Now that aliases are properly changed on the backend, this resulted in stale URL being pinged. This fixes by querying the backend after the app has been deployed. --- lib/cli/src/commands/app/mod.rs | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/lib/cli/src/commands/app/mod.rs b/lib/cli/src/commands/app/mod.rs index 67bf735c15b..63ddfb1b42d 100644 --- a/lib/cli/src/commands/app/mod.rs +++ b/lib/cli/src/commands/app/mod.rs @@ -115,7 +115,7 @@ pub enum WaitMode { /// Same as [Self::deploy], but also prints verbose information. pub async fn deploy_app_verbose( client: &WasmerClient, - mut opts: DeployAppOpts<'_>, + opts: DeployAppOpts<'_>, ) -> Result<(DeployApp, DeployAppVersion), anyhow::Error> { let owner = &opts.owner; let app = &opts.app; @@ -130,20 +130,6 @@ pub async fn deploy_app_verbose( eprintln!("Deploying app {pretty_name}...\n"); - let (owner, app_opt) = if let Some(owner) = owner { - (Some(owner.clone()), None) - } else if let Some(id) = &app.app_id { - let app = wasmer_api::query::get_app_by_id(client, id.clone()) - .await - .context("could not fetch app from backend")?; - - (Some(app.owner.global_name.clone()), Some(app)) - } else { - (None, None) - }; - - opts.owner = owner; - let wait = opts.wait; let version = deploy_app(client, opts).await?; @@ -155,13 +141,9 @@ pub async fn deploy_app_verbose( .inner() .to_string(); - let app = if let Some(app) = app_opt { - app - } else { - wasmer_api::query::get_app_by_id(client, app_id.clone()) - .await - .context("could not fetch app from backend")? - }; + let app = wasmer_api::query::get_app_by_id(client, app_id.clone()) + .await + .context("could not fetch app from backend")?; let full_name = format!("{}/{}", app.owner.global_name, app.name);