You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI: supabase start fails with "must be a directory" when supabase/functions/.env contains a multi-line value #7603
supabase start (and supabase functions serve) fail when supabase/functions/.env contains a multi-line value, such as a PEM private key in double quotes:
failed to copy edge runtime main service into container: destination "supabase_edge_runtime_<project_id>:/" must be a directory
With single-line values only, the same project starts fine.
This looks like the same failure mode as supabase/supabase#50088 (the docker cp of the Edge Runtime main service, introduced in 2.116.0), but with a different trigger: the bind mount for multi-line env values.
With printf 'FOO=bar\n' > supabase/functions/.env (or no .env at all), step 4 succeeds. For me this was consistent over several runs each.
What I found while debugging (by putting a logging wrapper for docker in front of PATH):
The CLI creates the Edge Runtime container with a bind mount -v <project>/supabase/.temp/start-secrets/supabase_edge_runtime_<project_id>/multiline-env:/root/.supabase/multiline-env:ro,Z, then runs docker cp - supabase_edge_runtime_<project_id>:/.
For that container, HEAD /containers/{id}/archive?path=/ returns 500 with error while creating mount source path '<project>/supabase/.temp/start-secrets/supabase_edge_runtime_<project_id>/multiline-env': mkdir .... docker cp then reports the misleading "must be a directory".
When I checked right before the docker cp, multiline-env on the host was a directory (drwx------), not a file.
With the wrapper slowing down the docker calls, the start sometimes succeeds, so this may be a race between writing the multiline-env file and creating the container.
Expected behavior
supabase start and supabase functions serve work with multi-line values in supabase/functions/.env, as they did before 2.116.0.
Screenshots
n/a
System information
OS: macOS 26.7.2 (arm64)
Supabase CLI: 3.1.0 (also reproduced with 2.122.0)
Workaround: keep all values in supabase/functions/.env on one line, e.g. a PEM key unquoted with literal \n, and replace \n with real line breaks in the function code.
Activity
fix(cli): keep multiline function env working on restarts (CLI-3131) (s…