The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add try catches in post delete analytics bucket clean up (#39969)
Joshen Limbae79225a27d
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsxindex e9c153e401a..e75b00d6117 100644--- a/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx+++ b/apps/studio/components/interfaces/Storage/AnalyticsBucketDetails/useAnalyticsBucketAssociatedEntities.tsx@@ -66,10 +66,17 @@ export const useAnalyticsBucketAssociatedEntities = (}export const useAnalyticsBucketDeleteCleanUp = () => {- const { mutateAsync: deleteFDW, isLoading: isDeletingWrapper } = useFDWDeleteMutation()+ const { mutateAsync: deleteFDW, isLoading: isDeletingWrapper } = useFDWDeleteMutation({+ // Silence default error handler toast+ onError: () => {},+ })- const { mutateAsync: deleteS3AccessKey, isLoading: isDeletingKey } =- useS3AccessKeyDeleteMutation()+ const { mutateAsync: deleteS3AccessKey, isLoading: isDeletingKey } = useS3AccessKeyDeleteMutation(+ {+ // Silence default error handler toast+ onError: () => {},+ }+ )const isDeleting = isDeletingWrapper || isDeletingKey@@ -91,26 +98,38 @@ export const useAnalyticsBucketDeleteCleanUp = () => {publication?: ReplicationPublication}) => {if (!!icebergWrapper && !!icebergWrapperMeta) {- await deleteFDW({- projectRef,- connectionString,- wrapper: icebergWrapper,- wrapperMeta: icebergWrapperMeta,- })+ try {+ await deleteFDW({+ projectRef,+ connectionString,+ wrapper: icebergWrapper,+ wrapperMeta: icebergWrapperMeta,+ })+ } catch (error: any) {+ console.error(`Failed to delete iceberg wrapper for ${bucketId}:`, error.message)+ }} else {console.warn(`Unable to find and delete iceberg wrapper for ${bucketId}`)}if (!!s3AccessKey) {- await deleteS3AccessKey({ projectRef, id: s3AccessKey.id })+ try {+ await deleteS3AccessKey({ projectRef, id: s3AccessKey.id })+ } catch (error: any) {+ console.error(`Failed to delete S3 access key for: ${bucketId}`, error.message)+ }} else {console.warn(`Unable to find and delete corresponding S3 access key for ${bucketId}`)}if (!!publication) {- // [TODO] Delete the publication+ try {+ // [TODO] Delete the publication+ } catch (error: any) {+ console.error(`Failed to delete replication publication for: ${bucketId}`, error.message)+ }} else {- console.log(`Unable to find and delete corresponding publication for ${bucketId}`)+ console.warn(`Unable to find and delete replication publication for ${bucketId}`)}}diff --git a/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx b/apps/studio/components/interfaces/Storage/CreateBucketModal.tsxindex e045aaaf671..8db8ca83806 100644--- a/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx+++ b/apps/studio/components/interfaces/Storage/CreateBucketModal.tsx@@ -265,7 +265,7 @@ export const CreateBucketModal = ({</ButtonTooltip></DialogTrigger>- <DialogContent>+ <DialogContent aria-describedby={undefined}><DialogHeader><DialogTitle>Create a {isStorageV2 ? config.singularName : 'storage'} bucket</DialogTitle></DialogHeader>diff --git a/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx b/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsxindex 7bfffb2222a..3208dfedd62 100644--- a/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx+++ b/apps/studio/components/interfaces/Storage/CreateSpecializedBucketModal.tsx@@ -227,7 +227,7 @@ export const CreateSpecializedBucketModal = ({</ButtonTooltip></DialogTrigger>- <DialogContent>+ <DialogContent aria-describedby={undefined}><DialogHeader><DialogTitle>Create {config.singularName} bucket</DialogTitle></DialogHeader>diff --git a/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx b/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsxindex 8f6d3124025..40e67daa13b 100644--- a/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx+++ b/apps/studio/components/interfaces/Storage/DeleteBucketModal.tsx@@ -127,15 +127,17 @@ export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModaconst { mutate: deleteAnalyticsBucket, isLoading: isDeletingAnalyticsBucket } =useAnalyticsBucketDeleteMutation({onSuccess: async () => {- await deleteAnalyticsBucketCleanUp({- projectRef,- bucketId: bucket.id,- icebergWrapper,- icebergWrapperMeta,- s3AccessKey,- publication,- })-+ if (project?.connectionString) {+ await deleteAnalyticsBucketCleanUp({+ projectRef,+ connectionString: project.connectionString,+ bucketId: bucket.id,+ icebergWrapper,+ icebergWrapperMeta,+ s3AccessKey,+ publication,+ })+ }toast.success(`Successfully deleted analytics bucket ${bucket.id}`)if (isStorageV2) {router.push(`/project/${projectRef}/storage/analytics`)@@ -171,7 +173,7 @@ export const DeleteBucketModal = ({ visible, bucket, onClose }: DeleteBucketModaif (!open) onClose()}}>- <DialogContent>+ <DialogContent aria-describedby={undefined}><DialogHeader><DialogTitle>Confirm deletion of {bucket.id}</DialogTitle></DialogHeader>