Skip to content

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

Update initialization of sb client in feedback

Joshen Lim09ce73fb475b
diff --git a/package.json b/package.json
index 7235aae7e7f..2c6c7e75b18 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,6 @@
],
"dependencies": {
"@mdx-js/react": "^2.1.1",
- "html-to-image": "^1.10.1",
"mini-svg-data-uri": "^1.4.4"
}
}
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts b/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts
index 16a30ad725d..2cabae9c7bc 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts
@@ -1,23 +1,8 @@
-import { compact } from 'lodash'
import { createClient } from '@supabase/supabase-js'
import { uuidv4 } from 'lib/helpers'
const SUPPORT_API_URL = process.env.NEXT_PUBLIC_SUPPORT_API_URL || ''
const SUPPORT_API_KEY = process.env.NEXT_PUBLIC_SUPPORT_ANON_KEY || ''
-const supportSupabaseClient = createClient(SUPPORT_API_URL, SUPPORT_API_KEY, {
- auth: {
- persistSession: false,
- autoRefreshToken: false,
- // @ts-ignore
- multiTab: false,
- detectSessionInUrl: false,
- localStorage: {
- getItem: (key: string) => undefined,
- setItem: (key: string, value: string) => {},
- removeItem: (key: string) => {},
- },
- },
-})
export const convertB64toBlob = (image: string) => {
const contentType = 'image/png'
@@ -41,10 +26,25 @@ export const convertB64toBlob = (image: string) => {
}
export const uploadAttachment = async (ref: string, image: string) => {
+ const supabaseClient = createClient(SUPPORT_API_URL, SUPPORT_API_KEY, {
+ auth: {
+ persistSession: false,
+ autoRefreshToken: false,
+ // @ts-ignore
+ multiTab: false,
+ detectSessionInUrl: false,
+ localStorage: {
+ getItem: (key: string) => undefined,
+ setItem: (key: string, value: string) => {},
+ removeItem: (key: string) => {},
+ },
+ },
+ })
+
const blob = convertB64toBlob(image)
const name = `${ref || 'no-project'}/${uuidv4()}.png`
const options = { cacheControl: '3600' }
- const { data: file, error: uploadError } = await supportSupabaseClient.storage
+ const { data: file, error: uploadError } = await supabaseClient.storage
.from('feedback-attachments')
.upload(name, blob, options)
@@ -54,7 +54,7 @@ export const uploadAttachment = async (ref: string, image: string) => {
}
if (file) {
- const { data } = await supportSupabaseClient.storage
+ const { data } = await supabaseClient.storage
.from('feedback-attachments')
.createSignedUrls([file.path], 10 * 365 * 24 * 60 * 60)
return data?.[0].signedUrl