Skip to content

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

fix connection issues moving away from array POST

Jonathan Summers-Muirbeb159ebb010
diff --git a/studio/components/interfaces/Integrations/IntegrationPanels.tsx b/studio/components/interfaces/Integrations/IntegrationPanels.tsx
index 9cf53225dfa..5aa16fbbde3 100644
--- a/studio/components/interfaces/Integrations/IntegrationPanels.tsx
+++ b/studio/components/interfaces/Integrations/IntegrationPanels.tsx
@@ -67,6 +67,8 @@ const IntegrationInstallation = React.forwardRef<HTMLLIElement, IntegrationInsta
)
}
+ console.log(connection)
+
return (
<li
key={connection.id}
@@ -135,9 +137,9 @@ const IntegrationConnection = React.forwardRef<HTMLLIElement, IntegrationConnect
<div className="flex flex-col gap-1">
<div className="flex gap-2 items-center">
<HandleIcon type={'Supabase'} />
- <span>{projects.byId(connection.project_ref)?.name}</span>
+ <span>{projects.byId(connection.supabase_project_id)?.name}</span>
<IconArrowRight size={14} className="text-scale-900" strokeWidth={1.5} />
- {!connection.metadata.framework ? (
+ {!connection?.metadata?.framework ? (
<HandleIcon type={type} />
) : (
<img
@@ -147,7 +149,7 @@ const IntegrationConnection = React.forwardRef<HTMLLIElement, IntegrationConnect
alt={`icon`}
/>
)}
- <span>{connection.metadata.name}</span>
+ <span>{connection.metadata?.name}</span>
</div>
<div className="flex gap-3 items-center">
diff --git a/studio/components/interfaces/Integrations/ProjectLinker.tsx b/studio/components/interfaces/Integrations/ProjectLinker.tsx
index 8f183b8b7c8..570de471499 100644
--- a/studio/components/interfaces/Integrations/ProjectLinker.tsx
+++ b/studio/components/interfaces/Integrations/ProjectLinker.tsx
@@ -65,21 +65,19 @@ const ProjectLinker = ({
createConnections({
organizationIntegrationId,
- connections: [
- {
- foreign_project_id: vercelProjectId,
- supabase_project_id: supabaseProjectId,
- integrationId: INTEGRATION_INTERNAL_ID,
- metadata: {
- ...projectDetails,
- supabaseConfig: {
- projectEnvVars: {
- write: true,
- },
+ connection: {
+ foreign_project_id: vercelProjectId,
+ supabase_project_id: supabaseProjectId,
+ integrationId: INTEGRATION_INTERNAL_ID,
+ metadata: {
+ ...projectDetails,
+ supabaseConfig: {
+ projectEnvVars: {
+ write: true,
},
},
},
- ],
+ },
})
}
diff --git a/studio/data/integrations/integration-connections-create-mutation.ts b/studio/data/integrations/integration-connections-create-mutation.ts
index 3c58ea49072..170a18a2404 100644
--- a/studio/data/integrations/integration-connections-create-mutation.ts
+++ b/studio/data/integrations/integration-connections-create-mutation.ts
@@ -4,21 +4,21 @@ import { API_URL } from 'lib/constants'
export type IntegrationConnectionsCreateVariables = {
organizationIntegrationId: string
- connections: {
+ connection: {
foreignProjectId: string
supabaseProjectId: string
integrationId: number
metadata: any
- }[]
+ }
}
export async function createIntegrationConnections({
organizationIntegrationId,
- connections,
+ connection,
}: IntegrationConnectionsCreateVariables) {
const response = await post(`${API_URL}/integrations/vercel/connections`, {
organization_integration_id: organizationIntegrationId,
- connections,
+ connection,
})
if (response.error) {
throw response.error
diff --git a/studio/data/integrations/integrations-query.ts b/studio/data/integrations/integrations-query.ts
index 39cc1f7b7ad..1865da940d3 100644
--- a/studio/data/integrations/integrations-query.ts
+++ b/studio/data/integrations/integrations-query.ts
@@ -133,7 +133,7 @@ export type IntegrationProjectConnection = {
created_at: string
updated_at: string
added_by: addedBy
- project_ref: string
+ supabase_project_id: string
organization_integration_id: string
metadata: metadata
}