Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Assign region for available-versions to be americas if region is auto (#52078)

Joshen Lim86ce3af1b44e
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts
index c6e8e5d850e..0f9d125bdd5 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.test.ts
@@ -22,8 +22,9 @@ import {
import type { PostgresEngine, ReleaseChannel } from '@/data/projects/new-project.constants'
describe('smartRegionToExactRegion', () => {
- it('maps the Auto option to the auto region code', () => {
- expect(smartRegionToExactRegion(AUTO_REGION_VALUE)).toBe('auto')
+ it('maps the Auto option to the exact region of Americas', () => {
+ expect(smartRegionToExactRegion(AUTO_REGION_VALUE)).toBe(smartRegionToExactRegion('Americas'))
+ expect(smartRegionToExactRegion(AUTO_REGION_VALUE)).toBe('East US (North Virginia)')
})
it('passes through values that are not smart regions', () => {
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
index 0d984745a22..4c4307ddc57 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
@@ -14,8 +14,9 @@ import {
export const AUTO_REGION_VALUE = 'best_available'
export function smartRegionToExactRegion(smartOrExactRegion: string) {
- if (smartOrExactRegion === AUTO_REGION_VALUE) return 'auto'
- return SMART_REGION_TO_EXACT_REGION_MAP.get(smartOrExactRegion) ?? smartOrExactRegion
+ // available-versions doesn't accept 'auto', so look versions up against the Americas region for Auto
+ const smartRegion = smartOrExactRegion === AUTO_REGION_VALUE ? 'Americas' : smartOrExactRegion
+ return SMART_REGION_TO_EXACT_REGION_MAP.get(smartRegion) ?? smartRegion
}
export function getAvailableRegions(