mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 05:09:12 +03:00
<img width="1512" height="818" alt="introspection" src="https://github.com/user-attachments/assets/5c0e4c6a-c0e9-496d-8768-4a55a2433268" /> ## Summary Adds an in-product admonition on the Infrastructure Settings page when a project has pg_graphql < 1.6.0 installed, warning users that GraphQL introspection will be disabled by default after upgrading. Links to upgrade notes docs with the opt-in SQL. The admonition is purely informational — it renders alongside the upgrade button, does not block the upgrade. ## Context pg_graphql 1.6.0 disables GraphQL introspection by default. The change is upgrade-triggered (not backported), so users on 1.5.x will only encounter it when their AMI bundles 1.6.0+. To prevent surprise breakage of tools that rely on `__schema`/`__type` (GraphiQL, codegen, Relay compiler, etc.), Studio surfaces this admonition before they upgrade. Design discussion in [PSQL-1199](https://linear.app/supabase/issue/PSQL-1199/prepare-dashboard-notification-for-pg-graphql-breaking-change). ## Companion PR This depends on the schema change in [supabase/platform#32954](https://github.com/supabase/platform/pull/32954) which adds the new `warnings` field to `ProjectUpgradeEligibilityResponse`. ## Admonition copy - **Title:** \"GraphQL introspection will be disabled by default after upgrade\" - **Body:** \"After upgrading, queries to \`__schema\` and \`__type\` will return an error unless introspection is explicitly re-enabled on the schema. Regular data queries are not affected.\" - **CTA:** \"Read upgrade notes\" → links to the new docs section ## Related - Linear: [PSQL-1199](https://linear.app/supabase/issue/PSQL-1199/prepare-dashboard-notification-for-pg-graphql-breaking-change) - Parent rollout: [PSQL-1163](https://linear.app/supabase/issue/PSQL-1163/breaking-change-pg-graphql-introspection-rollout) - Companion platform PR: https://github.com/supabase/platform/pull/32954 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Added “Upgrading to pg_graphql 1.6.0” and updated pg_graphql docs: introspection is disabled by default, how to re-enable per schema, verification steps, and affected tools. * **New Features** * Upgrade settings UI now shows validation warnings about introspection with links to upgrade notes. * **Chores** * Added "GraphiQL" to MDX spelling allow list and added upgrade-warning types to API surface. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46096?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
68 lines
2.6 KiB
TypeScript
68 lines
2.6 KiB
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import { components } from 'api-types'
|
|
import { IS_PLATFORM } from 'common'
|
|
|
|
import { configKeys } from './keys'
|
|
import { get, handleError } from '@/data/fetchers'
|
|
import { useProjectDetailQuery } from '@/data/projects/project-detail-query'
|
|
import { PROJECT_STATUS } from '@/lib/constants/infrastructure'
|
|
import type { ResponseError, UseCustomQueryOptions } from '@/types'
|
|
|
|
export type ProjectUpgradeTargetVersion = { postgres_version: string; release_channel: string }
|
|
export type ProjectUpgradeEligibilityVariables = { projectRef?: string }
|
|
export type ProjectUpgradeEligibilityResponse =
|
|
components['schemas']['ProjectUpgradeEligibilityResponse']
|
|
export type ProjectUpgradeEligibilityValidationError =
|
|
ProjectUpgradeEligibilityResponse['validation_errors'][number]
|
|
export type ProjectUpgradeEligibilityWarning = ProjectUpgradeEligibilityResponse['warnings'][number]
|
|
|
|
/**
|
|
* Fetches upgrade eligibility information for a project.
|
|
*
|
|
* @param projectRef - The project's reference identifier
|
|
* @returns The project upgrade eligibility response, or `undefined` if no data was returned
|
|
* @throws Error if `projectRef` is not provided
|
|
*/
|
|
export async function getProjectUpgradeEligibility(
|
|
{ projectRef }: ProjectUpgradeEligibilityVariables,
|
|
signal?: AbortSignal
|
|
): Promise<ProjectUpgradeEligibilityResponse | undefined> {
|
|
if (!projectRef) throw new Error('projectRef is required')
|
|
|
|
const { data, error } = await get('/v1/projects/{ref}/upgrade/eligibility', {
|
|
params: { path: { ref: projectRef } },
|
|
signal,
|
|
})
|
|
|
|
if (error) handleError(error)
|
|
return data as ProjectUpgradeEligibilityResponse | undefined
|
|
}
|
|
|
|
export type ProjectUpgradeEligibilityData = Awaited<ReturnType<typeof getProjectUpgradeEligibility>>
|
|
export type ProjectUpgradeEligibilityError = ResponseError
|
|
|
|
export const useProjectUpgradeEligibilityQuery = <TData = ProjectUpgradeEligibilityData>(
|
|
{ projectRef }: ProjectUpgradeEligibilityVariables,
|
|
{
|
|
enabled = true,
|
|
...options
|
|
}: UseCustomQueryOptions<
|
|
ProjectUpgradeEligibilityData,
|
|
ProjectUpgradeEligibilityError,
|
|
TData
|
|
> = {}
|
|
) => {
|
|
const { data: project } = useProjectDetailQuery({ ref: projectRef })
|
|
return useQuery<ProjectUpgradeEligibilityData, ProjectUpgradeEligibilityError, TData>({
|
|
queryKey: configKeys.upgradeEligibility(projectRef),
|
|
queryFn: ({ signal }) => getProjectUpgradeEligibility({ projectRef }, signal),
|
|
enabled:
|
|
enabled &&
|
|
project !== undefined &&
|
|
project.status === PROJECT_STATUS.ACTIVE_HEALTHY &&
|
|
typeof projectRef !== 'undefined' &&
|
|
IS_PLATFORM,
|
|
...options,
|
|
})
|
|
}
|