Skip to content

feat(cli): port functions deploy#5561

Open
7ttp wants to merge 7 commits into
supabase:developfrom
7ttp:feat/functions-deploy
Open

feat(cli): port functions deploy#5561
7ttp wants to merge 7 commits into
supabase:developfrom
7ttp:feat/functions-deploy

Conversation

@7ttp

@7ttp 7ttp commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

TL;DR

ports functions deploy to native ts

What’s introduced

adds the native ts implementation for supabase functions deploy,
keeping the existing command surface for default API deploys, docker fallback, import maps, static files, pruning,
disabled functions, and structured output.
also preserves the user facing behavior while making the default path api-based/dockerless (same as the other pr)

& includes coverage for both

ref:

  • Closes CLI-1319

@7ttp 7ttp requested a review from a team as a code owner June 12, 2026 08:03
@7ttp 7ttp self-assigned this Jun 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

useDocker: Flag.boolean("use-docker").pipe(
Flag.withDescription("Use Docker to bundle functions locally."),
Flag.withHidden,
),

P1 Badge Restore Docker as the legacy deploy default

When legacy users run supabase functions deploy without --use-api, this flag now parses as false, so deployFunctions takes the server-side API path instead of the local Docker bundler. The Go CLI that this legacy shell is porting sets --use-docker to default true in apps/cli-go/cmd/functions.go:155-157, and apps/cli-go/internal/functions/deploy/deploy.go:56-58 uses Docker whenever it is running; only an explicit --use-api opts out. This changes the default deployment artifact/path for existing stable CLI users and can break projects that rely on Docker/local bundling behavior.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/legacy/commands/functions/deploy/deploy.handler.ts
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94aa2f0097

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/next/commands/functions/deploy/deploy.handler.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 59977ff17d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

);
}

const useLocalBundler = flags.useDocker || flags.legacyBundle;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Docker as the default deploy mode

When legacy users run supabase functions deploy without mode flags while Docker is running, the Go command takes the Docker path because useDocker is registered with a default of true in apps/cli-go/cmd/functions.go; here the deploy mode is selected only from explicit boolean flags, which both default to false, so the normal invocation now always uses the server-side API bundler. That changes the ported command's default behavior and can break deployments that rely on the local Docker bundling path unless users discover and pass the hidden --use-docker flag.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional, the native port should default to api

Comment thread apps/cli/src/shared/functions/deploy.ts
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a14a8e908d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/shared/functions/deploy.ts
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts
@7ttp 7ttp force-pushed the feat/functions-deploy branch from 713059d to 67a5fc2 Compare June 12, 2026 13:34
@7ttp 7ttp force-pushed the feat/functions-deploy branch from 67a5fc2 to e456290 Compare June 12, 2026 13:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e456290738

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/shared/functions/deploy.ts
Comment thread apps/cli/src/shared/functions/deploy.ts
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 237af1e14d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/shared/functions/deploy.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ec9a343578

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/shared/functions/deploy.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6bc946519

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/cli/src/legacy/commands/functions/deploy/deploy.command.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts
Comment thread apps/cli/src/shared/functions/deploy.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ce91eb76b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +684 to +686
if (entry.isDirectory()) {
files.push(...(await listFilesRecursive(pathname)));
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fail globbed static directories instead of dropping them

When static_files uses a glob that matches a directory, such as ./functions/foo/assets/* with assets/templates/ present, this recursion skips the directory and only considers files below it, so the later isDirectory() check never sees the matched directory; the deploy then warns/continues or uploads only sibling files while omitting a configured static path. Fresh evidence beyond the earlier literal-directory comment is that glob expansion now calls listFilesRecursive, whereas the Go path's fs.Glob returns matched directories and addFile fails on them.

Useful? React with 👍 / 👎.

Comment on lines +118 to +120
return Object.fromEntries(
Object.entries(value).filter(([key, field]) => key !== "import_map_path" || field !== null),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle nullable function fields before decoding

When --use-docker lists a source-deployed function whose API row includes ezbr_sha256: null (or another optional function field returned as null), this normalizer only removes null import_map_path; the subsequent FunctionResponse schema still rejects null for fields such as ezbr_sha256, so deploy/prune can fail before hash comparison even though the Go client accepts those pointer fields as nil. Strip all known optional null fields, or decode this response leniently, before passing it to the strict schema.

Useful? React with 👍 / 👎.

Comment on lines +1702 to +1705
const loadedConfig = yield* loadProjectConfig(dependencies.projectRoot);
const configFunctions = yield* inferFunctionsManifest({
cwd: dependencies.projectRoot,
config: loadedConfig?.config,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor remote function config before deploying

When supabase/config.toml has [remotes.<name>] overrides and the user deploys with --project-ref matching that remote, this loads the unmerged base config before resolving the target project ref and then infers functions from that base only. The Go deploy path sets Config.ProjectId from the resolved project ref before LoadConfig, which merges the matching remote block, so remote-specific functions settings such as verify_jwt, entrypoint, static_files, or even remote-only function slugs are ignored by this port.

Useful? React with 👍 / 👎.

dashboardUrl: legacyDashboardUrl(cliConfig.profile),
yes,
rawArgs,
edgeRuntimeVersion: DEFAULT_VERSIONS["edge-runtime"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use configured edge-runtime image for legacy Docker deploys

When a legacy project has supabase/.temp/edge-runtime-version from an update/pin and runs functions deploy --use-docker, this always passes the package default edge-runtime version into the bundler. The Go config loader replaces Config.EdgeRuntime.Image from that file before Docker bundling, so the native legacy deploy can bundle with a different runtime image than the rest of the project and produce different eszip output.

Useful? React with 👍 / 👎.

pull Bot pushed a commit to pjpjq/cli that referenced this pull request Jun 15, 2026
## TL;DR

fixes nullable function import map paths

## prob

- While testing the ported `functions deploy` flow here:
supabase#5561
I found that `functions list` could fall back to `request_failed`
because the management api can return
 `import_map_path: null`

Go already accepted that null shape, but the generated ts contract only
accepted a string

basically this updates the generated function response contracts to
accept `null` for `import_map_path`
and adds a integration coverage around it! 

## ref

- smol regression of: (supabase#5185)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant