mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
fix: use storage endpoint in S3 settings (#37469)
* fix: use storage endpoint in S3 settings * Update retrieval of endpoint for analytics bucket related components --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
1 parent
e7aef7fc9c
commit
fbef43fbbc
6 files changed
+9
-8
No files matched your search
+1
-1
@@ -24,7 +24,7 @@ export const SimpleConfigurationDetails = ({ bucketName }: { bucketName: string
|
||||
const { data: apiKeys } = useAPIKeysQuery({ projectRef: project?.ref })
|
||||
const { data: settings } = useProjectSettingsV2Query({ projectRef: project?.ref })
|
||||
const protocol = settings?.app_config?.protocol ?? 'https'
|
||||
const endpoint = settings?.app_config?.endpoint
|
||||
const endpoint = settings?.app_config?.storage_endpoint || settings?.app_config?.endpoint
|
||||
|
||||
const { serviceKey } = getKeys(apiKeys)
|
||||
const serviceApiKey = serviceKey?.api_key ?? 'SUPABASE_CLIENT_SERVICE_KEY'
|
||||
|
||||
@@ -80,7 +80,7 @@ export const S3Connection = () => {
|
||||
})
|
||||
|
||||
const protocol = settings?.app_config?.protocol ?? 'https'
|
||||
const endpoint = settings?.app_config?.endpoint
|
||||
const endpoint = settings?.app_config?.storage_endpoint || settings?.app_config?.endpoint
|
||||
const hasStorageCreds = storageCreds?.data && storageCreds.data.length > 0
|
||||
const s3connectionUrl = getConnectionURL(projectRef ?? '', protocol, endpoint)
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ export const convertToBytes = (size: number, unit: StorageSizeUnits = StorageSiz
|
||||
}
|
||||
|
||||
function getStorageURL(projectRef: string, protocol: string, endpoint?: string) {
|
||||
const projUrl = endpoint ? `${protocol}://${endpoint}` : `https://${projectRef}.supabase.co`
|
||||
const projUrl = endpoint
|
||||
? `${protocol}://${endpoint}`
|
||||
: `https://${projectRef}.storage.supabase.co`
|
||||
const url = new URL(projUrl)
|
||||
return url
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { PermissionAction } from '@supabase/shared-types/out/constants'
|
||||
import { snakeCase } from 'lodash'
|
||||
|
||||
import { WRAPPERS } from 'components/interfaces/Integrations/Wrappers/Wrappers.constants'
|
||||
import {
|
||||
@@ -8,10 +9,8 @@ import {
|
||||
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
|
||||
import { getKeys, useAPIKeysQuery } from 'data/api-keys/api-keys-query'
|
||||
import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
|
||||
import { useProjectStorageConfigQuery } from 'data/config/project-storage-config-query'
|
||||
import { FDWCreateVariables, useFDWCreateMutation } from 'data/fdw/fdw-create-mutation'
|
||||
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
|
||||
import { snakeCase } from 'lodash'
|
||||
import { useS3AccessKeyCreateMutation } from './s3-access-key-create-mutation'
|
||||
|
||||
export const useIcebergWrapperCreateMutation = () => {
|
||||
@@ -22,7 +21,7 @@ export const useIcebergWrapperCreateMutation = () => {
|
||||
|
||||
const { data: settings } = useProjectSettingsV2Query({ projectRef: project?.ref })
|
||||
const protocol = settings?.app_config?.protocol ?? 'https'
|
||||
const endpoint = settings?.app_config?.endpoint
|
||||
const endpoint = settings?.app_config?.storage_endpoint || settings?.app_config?.endpoint
|
||||
|
||||
const apiKey = secretKey?.api_key ?? serviceKey?.api_key ?? 'SUPABASE_CLIENT_API_KEY'
|
||||
|
||||
@@ -30,8 +29,6 @@ export const useIcebergWrapperCreateMutation = () => {
|
||||
|
||||
const canCreateCredentials = useCheckPermissions(PermissionAction.STORAGE_ADMIN_WRITE, '*')
|
||||
|
||||
const { data: config } = useProjectStorageConfigQuery({ projectRef: project?.ref })
|
||||
|
||||
const { mutateAsync: createS3AccessKey, isLoading: isCreatingS3AccessKey } =
|
||||
useS3AccessKeyCreateMutation()
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
app_config: {
|
||||
db_schema: 'public',
|
||||
endpoint: PROJECT_ENDPOINT,
|
||||
storage_endpoint: PROJECT_ENDPOINT,
|
||||
// manually added to force the frontend to use the correct URL
|
||||
protocol: PROJECT_ENDPOINT_PROTOCOL,
|
||||
},
|
||||
|
||||
+1
@@ -7225,6 +7225,7 @@ export interface components {
|
||||
app_config?: {
|
||||
db_schema: string
|
||||
endpoint: string
|
||||
storage_endpoint: string
|
||||
}
|
||||
cloud_provider: string
|
||||
db_dns_name: string
|
||||
|
||||
Reference in new issue
Block a user