diff --git a/backend/app/features/ingestion/api.py b/backend/app/features/ingestion/api.py index a029f595..6d4666a6 100644 --- a/backend/app/features/ingestion/api.py +++ b/backend/app/features/ingestion/api.py @@ -56,7 +56,8 @@ router = APIRouter(prefix="/ingestions", tags=["Ingestions"]) -MAX_UPLOAD_SIZE_BYTES = 50 * 1024 * 1024 +# Keep this below the NGINX Ingress body-size limit to allow multipart overhead. +MAX_UPLOAD_SIZE_BYTES = 320 * 1024 * 1024 STATEFUL_INGESTION_SOURCE_TYPES = ( IngestionSourceType.HPC_PATH, IngestionSourceType.HPC_UPLOAD, diff --git a/backend/tests/features/ingestion/test_api.py b/backend/tests/features/ingestion/test_api.py index 6bb1bcc5..065e2890 100644 --- a/backend/tests/features/ingestion/test_api.py +++ b/backend/tests/features/ingestion/test_api.py @@ -1989,10 +1989,16 @@ def test_path_endpoint_does_not_persist_empty_case_on_ingest_error( ) def test_save_uploaded_file_rejects_large_files(self, tmp_path: Path): - file_content = b"x" * (51 * 1024 * 1024) # 51MB + file_content = b"x" * 11 upload_file = UploadFile(file=BytesIO(file_content), filename="large_file.zip") - with pytest.raises(HTTPException) as exc_info: + with ( + patch( + "app.features.ingestion.api.MAX_UPLOAD_SIZE_BYTES", + 10, + ), + pytest.raises(HTTPException) as exc_info, + ): _save_uploaded_file_and_hash(upload_file, tmp_path / "large_file.zip") assert exc_info.value.status_code == 413 diff --git a/docs/deploy/nersc-spin-runbook.md b/docs/deploy/nersc-spin-runbook.md index 8bd16da3..5fa922a2 100644 --- a/docs/deploy/nersc-spin-runbook.md +++ b/docs/deploy/nersc-spin-runbook.md @@ -645,7 +645,7 @@ uploads before the API processes them. | Annotation key | Value | | -------------- | ----- | -| `nginx.ingress.kubernetes.io/proxy-body-size` | `52m` | +| `nginx.ingress.kubernetes.io/proxy-body-size` | `325m` | Keep this value slightly above the backend upload limit in `backend/app/features/ingestion/api.py` to allow multipart overhead. Update the