diff --git a/crates/tower-cmd/src/util/deploy.rs b/crates/tower-cmd/src/util/deploy.rs index 3ce5c5de..ffdd8e10 100644 --- a/crates/tower-cmd/src/util/deploy.rs +++ b/crates/tower-cmd/src/util/deploy.rs @@ -14,6 +14,10 @@ use tower_api::apis::Error; use tower_api::apis::ResponseContent; use tower_api::models::DeployAppResponse; +/// Advisory only: the server enforces the actual bundle-size limit and reports +/// it in its error response when a bundle is too large. +pub const LARGE_PACKAGE_WARNING_THRESHOLD: u64 = 500 * 1024 * 1024; + pub async fn upload_file_with_progress( out: &output::Out, api_config: &Configuration, @@ -36,13 +40,11 @@ pub async fn upload_file_with_progress( let metadata = file.metadata().await?; let file_size = metadata.len(); - // Check if bundle size exceeds the maximum allowed size - if file_size > tower_package::MAX_PACKAGE_SIZE { + if file_size > LARGE_PACKAGE_WARNING_THRESHOLD { let size_mb = file_size as f64 / (1024.0 * 1024.0); - let max_mb = tower_package::MAX_PACKAGE_SIZE as f64 / (1024.0 * 1024.0); - out.die(&format!( - "Your App is too big! ({:.2} MB) exceeds maximum allowed size ({:.0} MB). Please consider reducing app size by removing unnecessary files or import_paths in the Towerfile.", - size_mb, max_mb + out.write(&format!( + "Warning: Your app package is large ({:.2} MB). The server may reject it depending on its configured maximum bundle size. You can reduce app size by removing unnecessary files or import_paths in the Towerfile.\n", + size_mb )); } diff --git a/crates/tower-package/src/core.rs b/crates/tower-package/src/core.rs index b376f83a..69383c4f 100644 --- a/crates/tower-package/src/core.rs +++ b/crates/tower-package/src/core.rs @@ -15,8 +15,6 @@ use crate::towerfile::{Parameter, Towerfile}; // 3 - Change checksum algorithm to be cross-platform pub const CURRENT_PACKAGE_VERSION: i32 = 3; -pub const MAX_PACKAGE_SIZE: u64 = 50 * 1024 * 1024; - #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("Invalid path"))] diff --git a/crates/tower-package/src/lib.rs b/crates/tower-package/src/lib.rs index d876067b..3f8520ed 100644 --- a/crates/tower-package/src/lib.rs +++ b/crates/tower-package/src/lib.rs @@ -3,7 +3,7 @@ mod towerfile; pub use core::{ build_package, compute_sha256_bytes, compute_sha256_package, normalize_path, BuiltPackage, - Entry, Manifest, PackageInputs, CURRENT_PACKAGE_VERSION, MAX_PACKAGE_SIZE, + Entry, Manifest, PackageInputs, CURRENT_PACKAGE_VERSION, }; pub use towerfile::{App, Parameter, Towerfile};