From 74a57861b30418e4fbda0f60815807fc6b02b196 Mon Sep 17 00:00:00 2001 From: Tyler Hillery Date: Fri, 24 Jul 2026 09:54:07 -0500 Subject: [PATCH] chore(studio): remove region limitation for vector buckets (#48248) ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Remove the region limitation on vector buckets ## What is the current behavior? Currently vector buckets are limited to a subset of Supabase regions ## What is the new behavior? All supabase regions now have access to vector buckets ## Additional context ## Summary by CodeRabbit * **New Features** * Vector buckets are now available based solely on platform enablement, without region-based restrictions. * **Bug Fixes** * Removed the region limitation message and related region availability checks from the Storage Vectors page. * Updated vector bucket upgrade behavior to reflect platform availability more consistently. * **Tests** * Updated coverage to reflect the simplified platform-based availability behavior. --- .../VectorBuckets/RegionLimitation.tsx | 74 ------------------- .../project/[ref]/storage/vectors/index.tsx | 15 +--- .../[ref]/storage/vectors/index.test.tsx | 44 +---------- 3 files changed, 5 insertions(+), 128 deletions(-) delete mode 100644 apps/studio/components/interfaces/Storage/VectorBuckets/RegionLimitation.tsx diff --git a/apps/studio/components/interfaces/Storage/VectorBuckets/RegionLimitation.tsx b/apps/studio/components/interfaces/Storage/VectorBuckets/RegionLimitation.tsx deleted file mode 100644 index d8b133dc5eb..00000000000 --- a/apps/studio/components/interfaces/Storage/VectorBuckets/RegionLimitation.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { VectorBucket } from 'icons' -import { AWS_REGIONS } from 'shared-data' -import { Tooltip, TooltipContent, TooltipTrigger } from 'ui' -import { EmptyStatePresentational } from 'ui-patterns/EmptyStatePresentational' -import { PageContainer } from 'ui-patterns/PageContainer' -import { PageSection, PageSectionContent } from 'ui-patterns/PageSection' - -import { AVAILABLE_REPLICA_REGIONS } from '@/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants' -import { AlphaNotice } from '@/components/ui/AlphaNotice' -import { InlineLinkClassName } from '@/components/ui/InlineLink' -import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject' - -export const VECTOR_BUCKETS_AVAILABLE_REGIONS = [ - 'us-east-1', - 'us-east-2', - 'us-west-2', - 'eu-central-1', - 'ap-southeast-2', -] - -const getRegionNameFromCode = (code: string) => - Object.values(AWS_REGIONS).find((x) => x.code === code)?.displayName - -export const RegionLimitation = () => { - const { data: project } = useSelectedProjectQuery() - - const regionLabel = AVAILABLE_REPLICA_REGIONS.find((region) => - project?.region?.includes(region.region) - ) - - return ( - - - - - - Your project is in{' '} - - - {regionLabel?.name} - - {regionLabel?.region} - - , but Vector buckets are only available for{' '} - - certain regions - -
    - {VECTOR_BUCKETS_AVAILABLE_REGIONS.map((x) => ( -
  • - {getRegionNameFromCode(x)} - {x} -
  • - ))} -
-
-
- . We're actively looking to expand that soon. - - } - /> -
-
-
- ) -} diff --git a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx index 8a277b627ae..afc598aeda4 100644 --- a/apps/studio/pages/project/[ref]/storage/vectors/index.tsx +++ b/apps/studio/pages/project/[ref]/storage/vectors/index.tsx @@ -2,30 +2,17 @@ import { IS_PLATFORM, useParams } from 'common' import { BucketsUpgradePlan } from '@/components/interfaces/Storage/BucketsUpgradePlan' import { VectorsBuckets } from '@/components/interfaces/Storage/VectorBuckets' -import { - RegionLimitation, - VECTOR_BUCKETS_AVAILABLE_REGIONS, -} from '@/components/interfaces/Storage/VectorBuckets/RegionLimitation' import { DefaultLayout } from '@/components/layouts/DefaultLayout' import { StorageBucketsLayout } from '@/components/layouts/StorageLayout/StorageBucketsLayout' import StorageLayout from '@/components/layouts/StorageLayout/StorageLayout' import { useIsVectorBucketsEnabled } from '@/data/config/project-storage-config-query' -import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject' import type { NextPageWithLayout } from '@/types' const StorageVectorsPage: NextPageWithLayout = () => { const { ref: projectRef } = useParams() - const { data: project } = useSelectedProjectQuery() const isVectorBucketsEnabled = useIsVectorBucketsEnabled({ projectRef }) - // [Joshen] We're actively looking into lifting this restriction so can remove once done - const isAvailableInProjectRegion = VECTOR_BUCKETS_AVAILABLE_REGIONS.includes( - project?.region ?? '' - ) - - if (IS_PLATFORM && !isAvailableInProjectRegion) { - return - } else if (IS_PLATFORM && !isVectorBucketsEnabled) { + if (IS_PLATFORM && !isVectorBucketsEnabled) { return } else if (!isVectorBucketsEnabled) { return null diff --git a/apps/studio/tests/pages/project/[ref]/storage/vectors/index.test.tsx b/apps/studio/tests/pages/project/[ref]/storage/vectors/index.test.tsx index f5c0cd53e3e..49005e81ee2 100644 --- a/apps/studio/tests/pages/project/[ref]/storage/vectors/index.test.tsx +++ b/apps/studio/tests/pages/project/[ref]/storage/vectors/index.test.tsx @@ -3,7 +3,6 @@ import { http, HttpResponse } from 'msw' import { beforeEach, describe, expect, test, vi } from 'vitest' import type { ProjectStorageConfigData } from '@/data/config/project-storage-config-query' -import type { ProjectDetail } from '@/data/projects/project-detail-query' import { API_URL } from '@/lib/constants' import StorageVectorsPage from '@/pages/project/[ref]/storage/vectors' import { customRender } from '@/tests/lib/custom-render' @@ -39,16 +38,7 @@ vi.mock('@/lib/constants', async (importOriginal) => { }) // Stub the heavy leaf children — each fires its own queries and renders a large -// tree. We only assert which branch the page picks. Keep the real -// `VECTOR_BUCKETS_AVAILABLE_REGIONS` so the region gate runs for real. -vi.mock( - '@/components/interfaces/Storage/VectorBuckets/RegionLimitation', - async (importOriginal) => ({ - ...(await importOriginal>()), - RegionLimitation: () =>
region-limitation
, - }) -) - +// tree. We only assert which branch the page picks. vi.mock('@/components/interfaces/Storage/VectorBuckets', () => ({ VectorsBuckets: () =>
vectors-buckets
, })) @@ -57,18 +47,6 @@ vi.mock('@/components/interfaces/Storage/BucketsUpgradePlan', () => ({ BucketsUpgradePlan: ({ type }: { type: string }) =>
buckets-upgrade-plan-{type}
, })) -const AVAILABLE_REGION = 'us-east-1' -const UNAVAILABLE_REGION = 'ap-south-1' - -const mockProject = (region: string) => { - addAPIMock({ - method: 'get', - path: '/platform/projects/:ref', - // The page only reads `region` off the project - response: () => HttpResponse.json({ region } as unknown as ProjectDetail), - }) -} - const mockStorageConfig = (vectorBucketsEnabled: boolean) => { addAPIMock({ method: 'get', @@ -99,20 +77,9 @@ const mockDeploymentMode = (isCli: boolean) => { describe('StorageVectorsPage', () => { beforeEach(() => { mockIsPlatform.value = true - mockProject(AVAILABLE_REGION) }) - test('platform + region not supported: shows region limitation', async () => { - mockProject(UNAVAILABLE_REGION) - mockStorageConfig(true) - - customRender() - - expect(await screen.findByText('region-limitation')).toBeInTheDocument() - expect(screen.queryByText('vectors-buckets')).not.toBeInTheDocument() - }) - - test('platform + supported region + not enabled: shows upgrade plan', async () => { + test('platform + not enabled: shows upgrade plan', async () => { mockStorageConfig(false) customRender() @@ -121,7 +88,7 @@ describe('StorageVectorsPage', () => { expect(screen.queryByText('vectors-buckets')).not.toBeInTheDocument() }) - test('platform + supported region + enabled: shows vector buckets', async () => { + test('platform + enabled: shows vector buckets', async () => { mockStorageConfig(true) customRender() @@ -129,16 +96,13 @@ describe('StorageVectorsPage', () => { expect(await screen.findByText('vectors-buckets')).toBeInTheDocument() }) - test('CLI (non-platform, enabled): shows vector buckets, skips region/upgrade gates', async () => { + test('CLI (non-platform, enabled): shows vector buckets, skips upgrade gate', async () => { mockIsPlatform.value = false - // Even an unsupported region shouldn't gate off-platform - mockProject(UNAVAILABLE_REGION) mockDeploymentMode(true) customRender() expect(await screen.findByText('vectors-buckets')).toBeInTheDocument() - expect(screen.queryByText('region-limitation')).not.toBeInTheDocument() }) test('self-hosted (non-platform): renders nothing', async () => {