From ff5fae6639b7ceec31331df3ea08155e6f5963bb Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 07:10:56 +0000 Subject: [PATCH] fix(proxy): keep Prisma migrations offline on arm64 --- litellm-proxy-extras/litellm_proxy_extras/utils.py | 1 + .../tests/test_setup_database_fail_fast.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/litellm-proxy-extras/litellm_proxy_extras/utils.py b/litellm-proxy-extras/litellm_proxy_extras/utils.py index 369b6561931..e691a6bcd0e 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/utils.py +++ b/litellm-proxy-extras/litellm_proxy_extras/utils.py @@ -23,6 +23,7 @@ def _get_prisma_env() -> dict: prisma_env = os.environ.copy() if str_to_bool(os.getenv("PRISMA_OFFLINE_MODE")): # These env vars prevent Prisma from attempting downloads + prisma_env.setdefault("PRISMA_CLI_QUERY_ENGINE_TYPE", "binary") prisma_env["NPM_CONFIG_PREFER_OFFLINE"] = "true" prisma_env["NPM_CONFIG_CACHE"] = os.getenv( "NPM_CONFIG_CACHE", "/app/.cache/npm" diff --git a/litellm-proxy-extras/tests/test_setup_database_fail_fast.py b/litellm-proxy-extras/tests/test_setup_database_fail_fast.py index 8d66bf872de..0561ab21c02 100644 --- a/litellm-proxy-extras/tests/test_setup_database_fail_fast.py +++ b/litellm-proxy-extras/tests/test_setup_database_fail_fast.py @@ -12,6 +12,7 @@ import pytest from litellm_proxy_extras.utils import ( ProxyExtrasDBManager, + _get_prisma_env, _max_migration_timestamp, _migration_timestamp, ) @@ -29,6 +30,12 @@ def _fake_migrate_deploy_failure(returncode: int, stderr: str): return _run +def test_prisma_offline_mode_uses_cached_binary_engine(monkeypatch): + monkeypatch.setenv("PRISMA_OFFLINE_MODE", "true") + + assert _get_prisma_env()["PRISMA_CLI_QUERY_ENGINE_TYPE"] == "binary" + + def test_v2_p3018_permission_error_raises_runtime_error(monkeypatch, tmp_path): """v2: a permission failure during migrate deploy raises RuntimeError.""" monkeypatch.setenv("DATABASE_URL", "postgresql://u:p@localhost:9/x")