Skip to content

Conversation

@victorvianaom
Copy link

the supabase functions serve command is ignoring function name arguments and always serves all functions.

I think the expected behaviour is for it to accept function names as arguments (similar to deploy).

I’ve collected a few places where the example supabase functions serve hello-world is used throughout the docs:
https://supabase.com/docs/guides/functions/development-tips#skipping-authorization-checks
https://supabase.com/docs/guides/functions/function-configuration#skipping-authorization-checks
https://supabase.com/docs/guides/functions/quickstart-dashboard#cli
https://supabase.com/docs/guides/functions/quickstart#step-3-test-your-function-locally
https://supabase.com/docs/guides/functions/secrets#local-secrets

with the changes in this PR, it would be now possible to do:

supabase functions serve hello-world
supabase functions serve fun1 fun2 fun3 etc…

It also, addresses this issue: #4395

and adds tests.
It might look some tests are redundant, but I thought it would be better to cover these different cases, because we are going from ignored to any amount of functions.

and, about this —all hidden flag implementation, I added a comment about that, because it currently has no effect.

I also added slug validation to the serve command for the case where the function is not mentioned in the 'config.toml' file, this might allow to catch invalid slugs earlier in the development.



did many tests by hand, testing different combinations of functions and calling all function endpoints to check which of them are listening, like:


running:
Screenshot 2026-01-09 at 19 46 43

checking:
Screenshot 2026-01-09 at 19 45 06

I did not touch the file watcher, it keeps watching all functions, regardless of which ones are being served. I can implement that in a subsequent PR if you guys find it relevant. Although I think it might not be too relevant.

Lastly, there is kind of a bug (not introduced by this PR), where we are allowing "non existent functions" to be served (which naturally results in BOOT_ERROR of the deno worker as it doesn't find the file when it comes the time to get it, when the function is called). I was fixing that putting a check inside the "PopulatePerFunctionConfigs" function, but then the refactor of tests (mocking the existence of function files) was ocupying the most part of changes, so I reverted. I would like to know what are your thoughts on that, if that is relevant of course.

@victorvianaom victorvianaom requested a review from a team as a code owner January 9, 2026 23:10
@coveralls
Copy link

Pull Request Test Coverage Report for Build 20868263253

Details

  • 13 of 22 (59.09%) changed or added relevant lines in 3 files are covered.
  • 7 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.03%) to 56.147%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/functions/serve/serve.go 11 14 78.57%
cmd/functions.go 0 6 0.0%
Files with Coverage Reduction New Missed Lines %
internal/storage/rm/rm.go 2 80.61%
internal/gen/keys/keys.go 5 12.9%
Totals Coverage Status
Change from base Build 20844870884: -0.03%
Covered Lines: 6851
Relevant Lines: 12202

💛 - Coveralls

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.

2 participants