From d9f35c2be51a4c42c90e369fb808a7e76878745e Mon Sep 17 00:00:00 2001 From: Brad Heller Date: Fri, 21 Aug 2026 00:11:01 +0100 Subject: [PATCH 1/2] feat: let the server decide the maximum bundle size The CLI used to hard-reject any package over 50 MB before uploading. The server enforces its own bundle-size limit and reports it in its error response, so the client-side check was redundant, blocked servers configured with higher limits, and required a CLI release to change. The check is now a non-fatal warning above 50 MB, and MAX_PACKAGE_SIZE is removed from tower-package in favor of a local advisory threshold in the deploy path. --- crates/tower-cmd/src/util/deploy.rs | 14 ++++++++------ crates/tower-package/src/core.rs | 2 -- crates/tower-package/src/lib.rs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/tower-cmd/src/util/deploy.rs b/crates/tower-cmd/src/util/deploy.rs index 3ce5c5de..11bff93b 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 = 50 * 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}; From fd5cdf37124b085f71feb83434b3544fb8028330 Mon Sep 17 00:00:00 2001 From: Brad Heller Date: Fri, 21 Aug 2026 00:13:58 +0100 Subject: [PATCH 2/2] feat: raise the large-package warning threshold to 500 MB --- crates/tower-cmd/src/util/deploy.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/tower-cmd/src/util/deploy.rs b/crates/tower-cmd/src/util/deploy.rs index 11bff93b..ffdd8e10 100644 --- a/crates/tower-cmd/src/util/deploy.rs +++ b/crates/tower-cmd/src/util/deploy.rs @@ -16,7 +16,7 @@ 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 = 50 * 1024 * 1024; +pub const LARGE_PACKAGE_WARNING_THRESHOLD: u64 = 500 * 1024 * 1024; pub async fn upload_file_with_progress( out: &output::Out,