The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fix evaluation of protocol
Ruggero Tomaselli8ccbf4007907
diff --git a/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx b/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsxindex ac11e16bd6f..fa147f1dd84 100644--- a/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx+++ b/studio/components/interfaces/Home/NewProjectPanel/APIKeys.tsx@@ -7,7 +7,6 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'import { checkPermissions, useJwtSecretUpdateStatus, useProjectSettings } from 'hooks'import { DEFAULT_PROJECT_API_SERVICE_ID, IS_PLATFORM } from 'lib/constants'-import { PROJECT_ENDPOINT_PROTOCOL } from 'pages/api/constants'import Snippets from 'components/to-be-cleaned/Docs/Snippets'import Panel from 'components/ui/Panel'import SimpleCodeBlock from 'components/to-be-cleaned/SimpleCodeBlock'@@ -46,7 +45,7 @@ const APIKeys = () => {const isNotUpdatingJwtSecret =jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated- const apiUrl = `${IS_PLATFORM ? 'https' : PROJECT_ENDPOINT_PROTOCOL}://${apiConfig.endpoint}`+ const apiUrl = `${IS_PLATFORM ? 'https' : apiConfig.protocol}://${apiConfig.endpoint}`const anonKey = apiKeys.find((key: any) => key.tags === 'anon')const clientInitSnippet: any = Snippets.init(apiUrl)diff --git a/studio/components/interfaces/Settings/API/ServiceList.tsx b/studio/components/interfaces/Settings/API/ServiceList.tsxindex ce2097d0b03..e3cd14dc27c 100644--- a/studio/components/interfaces/Settings/API/ServiceList.tsx+++ b/studio/components/interfaces/Settings/API/ServiceList.tsx@@ -14,7 +14,6 @@ import Panel from 'components/ui/Panel'import PostgrestConfig from './PostgrestConfig'import { DisplayApiSettings } from 'components/ui/ProjectSettings'import { JWT_SECRET_UPDATE_ERROR_MESSAGES } from './API.constants'-import { PROJECT_ENDPOINT_PROTOCOL } from 'pages/api/constants'import { IS_PLATFORM } from 'lib/constants'import JWTSettings from './JWTSettings'@@ -79,7 +78,7 @@ const ServiceList: FC<Props> = ({ projectRef }) => {readOnlydisabledclassName="input-mono"- value={`${IS_PLATFORM ? 'https' : PROJECT_ENDPOINT_PROTOCOL}://${+ value={`${IS_PLATFORM ? 'https' : apiConfig?.protocol}://${apiConfig?.endpoint ?? '-'}`}descriptionText="A RESTful endpoint for querying and managing your database."diff --git a/studio/components/layouts/StorageLayout/StorageLayout.tsx b/studio/components/layouts/StorageLayout/StorageLayout.tsxindex 031a5935c33..91d3b1975b6 100644--- a/studio/components/layouts/StorageLayout/StorageLayout.tsx+++ b/studio/components/layouts/StorageLayout/StorageLayout.tsx@@ -42,6 +42,7 @@ const StorageLayout: FC<Props> = ({ title, children }) => {const { services, isLoading } = useProjectSettings(ref as string | undefined)const apiService = find(services ?? [], (service) => service.app.id === 1)const projectUrl = apiService?.app_config?.endpoint ?? ''+ const urlProtocol = apiService?.app_config?.protocolconst serviceKey = find(apiService?.service_api_keys ?? [], (key) => key.tags === 'service_role')const canAccessStorage = !isLoading && services && serviceKey@@ -52,7 +53,7 @@ const StorageLayout: FC<Props> = ({ title, children }) => {const initializeStorageStore = async () => {if (projectUrl) {if (serviceKey) {- storageExplorerStore.initStore(ref, projectUrl, serviceKey.api_key)+ storageExplorerStore.initStore(ref, projectUrl, serviceKey.api_key, urlProtocol)await storageExplorerStore.fetchBuckets()}} else {diff --git a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsxindex ea70fb700dd..4020fcbb44b 100644--- a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx+++ b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx@@ -4,7 +4,6 @@ import { Input, IconAlertCircle, IconLoader } from 'ui'import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events'import { useJwtSecretUpdateStatus, useProjectSettings } from 'hooks'import { DEFAULT_PROJECT_API_SERVICE_ID, IS_PLATFORM } from 'lib/constants'-import { PROJECT_ENDPOINT_PROTOCOL } from 'pages/api/constants'import Panel from 'components/ui/Panel'const DisplayConfigSettings = () => {@@ -56,7 +55,7 @@ const DisplayConfigSettings = () => {copydisabledclassName="input-mono"- value={`${IS_PLATFORM ? 'https' : PROJECT_ENDPOINT_PROTOCOL}://${apiConfig.endpoint}`}+ value={`${IS_PLATFORM ? 'https' : apiConfig.protocol}://${apiConfig.endpoint}`}descriptionText="A RESTful endpoint for querying and managing your database."layout="horizontal"/>diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.jsindex b9a1742668b..bc16b36db5f 100644--- a/studio/localStores/storageExplorer/StorageExplorerStore.js+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js@@ -8,7 +8,6 @@ import { createClient } from '@supabase/supabase-js'import { useStore } from 'hooks'import { copyToClipboard } from 'lib/helpers'import { IS_PLATFORM } from 'lib/constants'-import { PROJECT_ENDPOINT_PROTOCOL } from 'pages/api/constants'import {STORAGE_VIEWS,STORAGE_ROW_TYPES,@@ -97,17 +96,16 @@ class StorageExplorerStore {}}- initStore(projectRef, url, serviceKey) {+ initStore(projectRef, url, serviceKey, protocol = "http") {this.projectRef = projectRef- this.initializeSupabaseClient(serviceKey, url)+ this.initializeSupabaseClient(serviceKey, url, protocol)}/* Methods which are commonly used + For better readability */- initializeSupabaseClient = (serviceKey, serviceEndpoint) => {- console.debug(serviceEndpoint)+ initializeSupabaseClient = (serviceKey, serviceEndpoint, protocol) => {this.supabaseClient = createClient(- `${IS_PLATFORM ? 'https' : PROJECT_ENDPOINT_PROTOCOL}://${serviceEndpoint}`,+ `${IS_PLATFORM ? 'https' : protocol}://${serviceEndpoint}`,serviceKey,{auth: {diff --git a/studio/pages/api/props/project/[ref]/settings.ts b/studio/pages/api/props/project/[ref]/settings.tsindex 433ee7f95c8..7e076ddecbc 100644--- a/studio/pages/api/props/project/[ref]/settings.ts+++ b/studio/pages/api/props/project/[ref]/settings.ts@@ -1,7 +1,7 @@import { NextApiRequest, NextApiResponse } from 'next'import apiWrapper from 'lib/api/apiWrapper'-import { PROJECT_ENDPOINT } from 'pages/api/constants'+import { PROJECT_ENDPOINT, PROJECT_ENDPOINT_PROTOCOL } from 'pages/api/constants'export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)@@ -59,6 +59,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {db_schema: 'public',endpoint: PROJECT_ENDPOINT,realtime_enabled: true,+ protocol: PROJECT_ENDPOINT_PROTOCOL},},],