diff --git a/pkg/config/config.go b/pkg/config/config.go index 6e9ef96bb..02cbcfb88 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -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) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 43a292fc3..c12b78551 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -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 {