Skip to content

Conversation

@kallebysantos
Copy link
Member

What kind of change does this PR introduce?

Feature

What is the new behaviour?

Its allows Edge Functions Management API to use folder introspection and serve function metadata.
ref: supabase/supabase#40690, internal RFC

Additional context

screenshots image image

I'm keeping it very simple for now.
Please let me know if a more complex volume binding like this one is needed

binds := []string{}
for slug, fc := range functionsConfig {
if !fc.Enabled {
fmt.Fprintln(os.Stderr, "Skipped serving Function:", slug)
delete(functionsConfig, slug)
continue
}
modules, err := deploy.GetBindMounts(cwd, utils.FunctionsDir, "", fc.Entrypoint, fc.ImportMap, fsys)
if err != nil {
return nil, "", err
}
binds = append(binds, modules...)
fc.ImportMap = utils.ToDockerPath(fc.ImportMap)
fc.Entrypoint = utils.ToDockerPath(fc.Entrypoint)
functionsConfig[slug] = fc
for i, val := range fc.StaticFiles {
fc.StaticFiles[i] = utils.ToDockerPath(val)
}

cc @sweatybridge

@kallebysantos kallebysantos requested a review from a team as a code owner December 3, 2025 01:08
},
},
container.HostConfig{
Binds: []string{filepath.Join(cwd, utils.FunctionsDir) + ":/app/edge-functions:ro"},
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's try to use the binds directories returned from populatePerFunctionConfigs instead. It handles relative imports from ../../../parent.ts for eg.

.
+-- parent/index.ts
+-- supabase
|   +-- functions/slug/index.ts
|   +-- config.toml

Could you also double check that such functions work in the local studio UI?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hey Qiao! I was able to get the volume binds 💚
But currently, the studio is strict to only look functions in ./**/index.ts way — I didn't happen to think of that other possibility at the time 😅

Since you mentioned this behaviour,
it totally makes sense to add SUPABASE_INTERNAL_FUNCTIONS_CONFIG support for Studio, and I should probably do it in near future 🥹

For now, I think that its ok to only show what's inside supabase/functions folder.
Thx a lot for pointing it 💚

@kallebysantos kallebysantos force-pushed the feat-local-functions-studio-management-api branch from 4890a39 to 8764f93 Compare December 5, 2025 22:54
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