The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
ref: Use separate endpoint for retrieving single Vercel project (#19836)
Kamil Ogórekbcc99b0cb5ac
diff --git a/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx b/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsxindex 3f28da24576..30cc6f8cebc 100644--- a/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx+++ b/apps/studio/components/interfaces/Settings/Integrations/VercelIntegration/VercelSection.tsx@@ -120,9 +120,11 @@ You can change the scope of the access for Supabase by configuring: ''const integrationUrl =- process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'- ? 'https://vercel.com/integrations/supabase-v2-staging'- : 'https://vercel.com/integrations/supabase'+ process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod'+ ? 'https://vercel.com/integrations/supabase'+ : process.env.NEXT_PUBLIC_ENVIRONMENT === 'staging'+ ? `https://vercel.com/integrations/supabase-v2-staging`+ : 'https://vercel.com/integrations/supabase-v2-local'let connections =(isProjectScopeddiff --git a/apps/studio/components/to-be-cleaned/Integration/Vercel.utils.ts b/apps/studio/components/to-be-cleaned/Integration/Vercel.utils.tsindex ba2af99b6d5..b9ae4c8c945 100644--- a/apps/studio/components/to-be-cleaned/Integration/Vercel.utils.ts+++ b/apps/studio/components/to-be-cleaned/Integration/Vercel.utils.ts@@ -1,59 +1,49 @@import { post, get } from 'lib/common/fetch'import { INTEGRATION_ENVS_ALIAS } from 'lib/vercelConfigs'-import { Dictionary } from 'types'import { API_URL } from 'lib/constants'-export async function fetchVercelProjects({- vercelTeamId,+async function doFetchVercelProjects({vercelToken,+ vercelTeamId,+ id,}: {- vercelTeamId?: stringvercelToken: string-}): Promise<{ data?: Dictionary<any>[]; error?: string }> {+ vercelTeamId?: string+ id?: string+}) {let url = `${API_URL}/vercel/projects`+ if (id) {+ url += `/${id}`+ }if (vercelTeamId && vercelTeamId != 'null') {const query = new URLSearchParams({ teamId: vercelTeamId }).toString()url = `${url}?${query}`}- const response = await get(url, {+ const data = await get(url, {headers: { vercel_authorization: `Bearer ${vercelToken}` },})- if (response.error != null) {- return { error: `Retrieve vercel projects failed. ${response.error?.message}` }+ if (data.error != null) {+ return { error: `Retrieve vercel project${id ? '' : 's'} failed. ${data.error.message}` }}- return { data: response }+ return { data }}-/**- * /v6/projects/:id returns project alias with domain info.- * We need this to setup Supabase Auth site url on project creation.- *- * Do not update to /v8/projects/:id as it doesn't return alias info- */-export async function fetchVercelProject({- id,- vercelTeamId,- vercelToken,-}: {+export async function fetchVercelProjects(params: { vercelToken: string; vercelTeamId?: string }) {+ return (await doFetchVercelProjects(params)) as {+ data?: Record<string, any>[]+ error?: string+ }+}++export async function fetchVercelProject(params: {id: string- vercelTeamId?: stringvercelToken: string-}): Promise<{ data?: Dictionary<any>; error?: string }> {- let url = `${API_URL}/vercel/projects`- if (vercelTeamId && vercelTeamId != 'null') {- const query = new URLSearchParams({ id, teamId: vercelTeamId }).toString()- url = `${url}?${query}`- } else {- const query = new URLSearchParams({ id }).toString()- url = `${url}?${query}`- }- const data = await get(url, {- headers: { vercel_authorization: `Bearer ${vercelToken}` },- })- if (data.error != null) {- return { error: `Retrieve vercel project failed. ${data.error.message}` }+ vercelTeamId?: string+}) {+ return (await doFetchVercelProjects(params)) as {+ data?: Record<string, any>+ error?: string}- return { data }}export async function fetchVercelProjectEnvs({@@ -64,7 +54,7 @@ export async function fetchVercelProjectEnvs({id: stringvercelTeamId?: stringvercelToken: string-}): Promise<{ data?: Dictionary<any>[]; error?: string }> {+}): Promise<{ data?: Record<string, any>[]; error?: string }> {let url = `${API_URL}/vercel/projects/envs`if (vercelTeamId && vercelTeamId != 'null') {const query = new URLSearchParams({ projectId: id, teamId: vercelTeamId }).toString()diff --git a/apps/studio/pages/vercel/integrate.tsx b/apps/studio/pages/vercel/integrate.tsxindex 70d927ee5ce..38b349d0a5a 100644--- a/apps/studio/pages/vercel/integrate.tsx+++ b/apps/studio/pages/vercel/integrate.tsx@@ -154,16 +154,16 @@ class VercelIntegrationStore implements IVercelIntegrationStore {}}async getVercelProjects() {- const { data, error }: any = await fetchVercelProjects({+ const { data, error } = await fetchVercelProjects({vercelTeamId: this.teamId,vercelToken: this.token,})if (error) {toast.error(error)- } else {+ } else if (data) {this.vercelProjects = data// if currentProjectId available. Auto select it- if (data && this.currentProjectId) {+ if (this.currentProjectId) {// @ts-ignoreconst found = data.find((x: { id: string }) => (x.id = this.currentProjectId))if (found) this.selectedVercelProjectId = found.id