fix: error when Docker is not running for static_files bundle (#5169)#5170
Open
ChrisJr404 wants to merge 1 commit intosupabase:developfrom
Open
fix: error when Docker is not running for static_files bundle (#5169)#5170ChrisJr404 wants to merge 1 commit intosupabase:developfrom
ChrisJr404 wants to merge 1 commit intosupabase:developfrom
Conversation
…upabase#5169) When `supabase functions deploy` runs without `--use-api` and the Docker daemon is unreachable, the CLI falls through to the multipart API path. That path uploads function source but does not produce an eszip bundle, so any `static_files` declared in `config.toml` are dropped server-side and the deployed function silently ships without its templates. Detect this case before deploying. If any enabled function has `static_files` configured and Docker is not running, abort with a clear error listing the affected slugs and the remediation. Functions without `static_files` continue to fall back with the existing warning. Closes supabase#5169. Also addresses the silent-drop reported in supabase#4554.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
supabase functions deploydefaults to--use-docker(hidden flag, defaulttrue). When the Docker daemon is unreachable, the CLI printsWARNING: Docker is not runningand silently falls back to the multipart API upload path. That path streams function source but does not produce the eszip bundle the edge runtime needs to interpretstatic_files, so any templates declared inconfig.tomlare dropped server-side. The function deploys successfully, then fails at runtime whenDeno.readTextFile()can't find its template.This patch detects the case before any upload happens. If any enabled function has
static_filesconfigured and Docker is not running, the deploy aborts with:Functions without
static_fileskeep the existing warning + API-fallback behaviour, so this is only stricter for the configurations that would otherwise ship broken.A hard error is the right response here because the alternative is a silent regression that's only observable at runtime in production. The OP in #5169 explicitly accepts "throw an error" as the expected fix, and #4554 reported the same silent-drop behavior previously.
Closes #5169. Also addresses the silent-drop reported in #4554. Related discussion: https://github.com/orgs/supabase/discussions/45518
Files changed
internal/functions/deploy/deploy.go— pre-flight check before constructing the deploy options.internal/functions/deploy/deploy_test.go—TestDeployCommand/throws_error_when_static_files_configured_but_Docker_not_runningsimulates an unreachable Docker daemon (TCP listener bound then closed →IsErrConnectionFailed) and asserts the deploy returns an error mentioningDocker is not running,static_files, and the affected slug.Test plan
go build ./...go vet ./...go test ./internal/functions/deploy/...(8/8 PASS, including the new case)go test ./internal/functions/...(all packages green)