supabase/supabase · error · Error

Client endpoint is required

Error message

Client endpoint is required

What it means

Second precondition guard in regenerateSecret for clientEndpoint. Required to build the project Supabase client backing the regenerateClientSecret call. Fails fast before any network request.

Source

Thrown at apps/studio/data/oauth-server-apps/oauth-server-app-regenerate-secret-mutation.ts:21

import { oauthServerAppKeys } from './keys'
import { handleError } from '@/data/fetchers'
import { createProjectSupabaseClient } from '@/lib/project-supabase-client'
import type { ResponseError, UseCustomMutationOptions } from '@/types'

export type OAuthServerAppRegenerateSecretVariables = {
  projectRef: string | undefined
  clientId: string | undefined
  clientEndpoint: string | undefined
}

export async function regenerateSecret({
  projectRef,
  clientEndpoint,
  clientId,
}: OAuthServerAppRegenerateSecretVariables) {
  if (!projectRef) throw new Error('Project reference is required')
  if (!clientEndpoint) throw new Error('Client endpoint is required')
  if (!clientId) throw new Error('Oauth app client id is required')

  const supabaseClient = await createProjectSupabaseClient(projectRef, clientEndpoint)
  const { data, error } = await supabaseClient.auth.admin.oauth.regenerateClientSecret(clientId)

  if (error) handleError(error)
  return data
}

type OAuthAppRegenerateSecretData = Awaited<ReturnType<typeof regenerateSecret>>

export const useOAuthServerAppRegenerateSecretMutation = ({
  onSuccess,
  onError,
  ...options
}: Omit<
  UseCustomMutationOptions<
    OAuthAppRegenerateSecretData,

View on GitHub (pinned to beee91b9c2)

Solutions

  1. Pass clientEndpoint from auth settings.
  2. Disable the Regenerate action while clientEndpoint is undefined.
  3. Gate dependent UI on enabled: !!projectRef && !!clientEndpoint.

Example fix

// before
mutate({ projectRef, clientId })
// after
mutate({ projectRef, clientId, clientEndpoint: authSettings?.endpoint })
Defensive patterns

Strategy: validation

Validate before calling

if (!clientEndpoint) {
  disableRegenerateButton()
  return
}
mutate({ projectRef, clientEndpoint, clientId })

Type guard

const hasClientEndpoint = (
  v: Partial<OAuthServerAppRegenerateSecretVariables>
): v is OAuthServerAppRegenerateSecretVariables & { clientEndpoint: string } =>
  typeof v.clientEndpoint === 'string' && v.clientEndpoint.length > 0

Prevention

When it happens

Trigger: Regenerate invoked with projectRef present but clientEndpoint undefined, typically because auth settings have not resolved.

Common situations: Auth settings still loading; local dev missing the auth endpoint; consumer forgot to thread the endpoint.

Related errors


AI-assisted analysis of supabase/supabase@beee91b9c2 (2026-08-12). Data as JSON: /api/errors/867f7bcda29d5521. Report an issue: GitHub.