Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,13 @@ func (h *hookConfig) validate(hookType string) (err error) {
if h.URI == "" {
return errors.Errorf("Missing required field in config: auth.hook.%s.uri", hookType)
}
// Skip validation if URI contains unresolved env() reference
// This allows users to use env(SUPABASE_PROJECT_URL)/functions/v1/...
// which will be resolved at deploy time by the platform
if strings.Contains(h.URI, "env(") {
fmt.Fprintf(os.Stderr, "WARN: auth.hook.%s.uri contains env() reference, skipping local validation\n", hookType)
return nil
}
parsed, err := url.Parse(h.URI)
if err != nil {
return errors.Errorf("failed to parse template url: %w", err)
Expand Down
7 changes: 7 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ func TestValidateHookURI(t *testing.T) {
},
errorMsg: "Invalid hook config: auth.hook.valid pg-functions URI with unsupported secrets.secrets is unsupported for pg-functions URI",
},
{
name: "URI with env() reference skips validation",
hookConfig: hookConfig{
Enabled: true,
URI: "env(SUPABASE_PROJECT_URL)/functions/v1/send-email",
},
},
}

for _, tt := range tests {
Expand Down
Loading