Skip to content

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

fix: add custom message for 404 storage config errors (#39296)

Ivan Vasilov441825cc0fd8
diff --git a/apps/studio/components/interfaces/Storage/StorageSettings/S3Connection.tsx b/apps/studio/components/interfaces/Storage/StorageSettings/S3Connection.tsx
index 88e011ee10f..4be54f62c57 100644
--- a/apps/studio/components/interfaces/Storage/StorageSettings/S3Connection.tsx
+++ b/apps/studio/components/interfaces/Storage/StorageSettings/S3Connection.tsx
@@ -125,6 +125,15 @@ export const S3Connection = () => {
</div>
<DocsButton href={`${DOCS_URL}/guides/storage/s3/authentication`} />
</div>
+
+ {isErrorStorageConfig && (
+ <AlertError
+ className="mb-4"
+ subject="Failed to retrieve storage configuration"
+ error={configError}
+ />
+ )}
+
<Form_Shadcn_ {...form}>
<form id="s3-connection-form" onSubmit={form.handleSubmit(onSubmit)}>
{projectIsLoading ? (
@@ -153,15 +162,6 @@ export const S3Connection = () => {
</FormItemLayout>
)}
/>
-
- {isErrorStorageConfig && (
- <div className="px-8 pb-8">
- <AlertError
- subject="Failed to retrieve storage configuration"
- error={configError}
- />
- </div>
- )}
</CardContent>
<CardContent className="py-6">
diff --git a/apps/studio/data/config/project-storage-config-query.ts b/apps/studio/data/config/project-storage-config-query.ts
index 058fa95e9a9..be158636207 100644
--- a/apps/studio/data/config/project-storage-config-query.ts
+++ b/apps/studio/data/config/project-storage-config-query.ts
@@ -2,9 +2,9 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { components } from 'data/api'
import { get, handleError } from 'data/fetchers'
+import { IS_PLATFORM } from 'lib/constants'
import type { ResponseError } from 'types'
import { configKeys } from './keys'
-import { IS_PLATFORM } from 'lib/constants'
export type ProjectStorageConfigVariables = {
projectRef?: string
@@ -23,7 +23,15 @@ export async function getProjectStorageConfig(
signal,
})
- if (error) handleError(error)
+ if (error) {
+ // [Joshen] This is due to API not returning an error message on this endpoint if a 404 is returned
+ // Should only be a temporary patch, needs to be addressed on the API end
+ if ((error as any).code === 404) {
+ handleError({ ...(error as any), message: 'Storage configuration not found.' })
+ } else {
+ handleError(error)
+ }
+ }
return data
}