Skip to content

feat(cli): port functions serve#5634

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

feat(cli): port functions serve#5634
7ttp wants to merge 5 commits into
supabase:developfrom
7ttp:feat/functions-serve

Conversation

@7ttp

@7ttp 7ttp commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

TL;DR

ports functions serve to ts

what’s introduced

ports functions serve to native ts and wires it through the shared runtime for config resolution, function discovery, local runtime startup, restart handling, and log streaming
(for next, intentionally not wiring serve yet so we do not route it through the legacy docker path)

which aligns with the existing go behaviour...
& adds coverage across all of this!

ref

  • closes CLI-1320

@7ttp 7ttp requested a review from a team as a code owner June 19, 2026 14:43
@7ttp 7ttp marked this pull request as draft June 19, 2026 14:47

@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: 7ebca4f8b8

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
@7ttp 7ttp self-assigned this Jun 19, 2026
@7ttp 7ttp marked this pull request as ready for review June 20, 2026 16:56

@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: 36fc21715b

ℹ️ 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/scripts/build.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts
@7ttp 7ttp force-pushed the feat/functions-serve branch from 07b4438 to 36fc217 Compare June 20, 2026 20:14

@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: 9e56039568

ℹ️ 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/serve/serve.handler.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.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: 682ab78c6c

ℹ️ 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/serve/serve.command.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts
Comment thread apps/cli/src/shared/functions/serve.ts
@7ttp 7ttp force-pushed the feat/functions-serve branch from 11e342f to 37cf82d Compare June 21, 2026 09:12

@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: 37cf82d086

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts
Comment thread apps/cli/src/shared/functions/serve.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: bfac7d5d05

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.main.ts Outdated
@7ttp 7ttp force-pushed the feat/functions-serve branch from 852b129 to cc53b4e Compare June 21, 2026 13:51

@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: cc53b4e3ab

ℹ️ 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/serve.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: 6e613b7f1b

ℹ️ 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/cli/run.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.main.ts
Comment thread apps/cli/src/shared/functions/serve.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: ac6e44de8a

ℹ️ 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/serve.ts
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.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

if (!entry.isDirectory()) {

P2 Badge Discover symlinked function directories

When functions serve now reuses this helper, symlinked directories under supabase/functions are skipped because readdir({ withFileTypes: true }) reports the symlink itself and this loop requires entry.isDirectory(). The legacy Go serve path calls deploy.GetFunctionSlugs, which globs supabase/functions/*/index.ts and therefore includes a symlinked slug with an index.ts, so monorepos that symlink function folders will now serve zero or missing functions unless every slug is duplicated in config.

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
@7ttp

7ttp commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 09dd1c9fb0

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/deploy.ts
Comment thread apps/cli/src/shared/functions/serve.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: b872ab931b

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/cli/run.ts
Comment thread apps/cli/src/shared/functions/serve.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: 6edf2174f8

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.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: 8a4820ee76

ℹ️ 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/serve.ts Outdated
@7ttp 7ttp force-pushed the feat/functions-serve branch from 7a30a4b to 5bccd94 Compare June 22, 2026 14:24
@7ttp 7ttp force-pushed the feat/functions-serve branch from 4180ebb to bfb5bf6 Compare June 22, 2026 14:32

@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: bfb5bf6884

ℹ️ 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/serve.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: 967247230f

ℹ️ 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/serve.ts
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.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: 98dd0dcd9b

ℹ️ 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/serve.ts
Comment thread apps/cli/src/shared/functions/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.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: 37c551d20f

ℹ️ 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/serve.ts Outdated
Comment thread apps/cli/src/shared/functions/serve.ts
Comment thread apps/cli/src/shared/functions/serve.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: 5a7f3569f5

ℹ️ 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 +624 to +627
const loadedConfig = yield* loadProjectConfig(
projectRoot,
projectRef === undefined ? undefined : { projectRef },
);

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 Load serve env before decoding config

When config uses an env(...) value that must be coerced during schema decode and is only defined in the stack-style files loaded by loadServeProjectEnvironment (for example api.port = "env(API_PORT)" with API_PORT in root .env.development), this decodes via loadProjectConfig before that serve-specific environment is loaded on the next line. packages/config still performs pre-decode interpolation with its narrower .env/.env.local loader, so these numeric/boolean fields fail strict decode even though the Go stack loader accepted them; fresh evidence beyond the earlier env-file concern is that the new loader runs only after loadProjectConfig has already parsed the schema.

Useful? React with 👍 / 👎.

return yield* Effect.fail(new Error(message));
}

yield* reloadKong(projectId);

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 Keep env artifact cleanup active after Docker starts

When multiline/function env creates temp files and SIGINT/SIGTERM arrives after docker run -d succeeds but while the post-start work here is still running, the only cleanup handler for those artifacts was scoped to the runChildProcess call above and the caller has not yet received started.cleanup. The outer interrupt finalizer only removes the container, so secret-bearing /tmp/supabase-functions-serve-* directories can remain; fresh evidence is that cleanup is no longer registered during reloadKong or the subsequent watch-spec build.

Useful? React with 👍 / 👎.

Comment on lines +587 to +589
keys.push(
...(signingKeys.length > 0 ? signingKeys.map(toPublicSigningKey) : [defaultSigningKey]),
);

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 Gate default signing key on missing signing_keys_path

When auth.signing_keys_path is configured but the file contains no keys (for example [] during key setup/rotation), this zero-length check publishes the built-in default ES256 verification key. The legacy resolver only applies its fallback when SigningKeysPath is empty (apps/cli-go/pkg/config/config.go:1620-1622), so an explicit empty key file should not make protected functions accept tokens signed with the repository's default private key; base the fallback on whether a signing key path was configured, not only on signingKeys.length.

Useful? React with 👍 / 👎.

if (value === undefined) {
return undefined;
}
return Redacted.isRedacted(value) ? Redacted.value(value) : value;

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 Decrypt dotenvx secrets before revealing config

When a project stores config secrets as dotenvx encrypted: values and provides DOTENV_PRIVATE_KEY, @supabase/config only redacts the ciphertext and this unwraps it unchanged. The legacy Go loader decrypts Secret values during LoadConfig (apps/cli-go/pkg/config/secret.go), so functions serve now uses ciphertext for fields such as auth.jwt_secret or edge_runtime.secrets instead of the plaintext local stack values (and it silently continues where Go would fail without a key).

Useful? React with 👍 / 👎.

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