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

Its allows Edge Functions Management API to use folder introspection and
serve function details.
@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?

Comment on lines +1128 to +1131
cwd, err := os.Getwd()
if err != nil {
return errors.Errorf("failed to get working directory: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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