From 1396ce71f8077a8c60b03e8aad4839b7c4ee667b Mon Sep 17 00:00:00 2001 From: Tony Xiao Date: Tue, 19 Dec 2023 00:16:05 -0100 Subject: [PATCH] fix: delete connector config --- .../router/connectorConfigRouter.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/engine-backend/router/connectorConfigRouter.ts b/packages/engine-backend/router/connectorConfigRouter.ts index f0245ac5..fe9bc397 100644 --- a/packages/engine-backend/router/connectorConfigRouter.ts +++ b/packages/engine-backend/router/connectorConfigRouter.ts @@ -114,9 +114,18 @@ export const connectorConfigRouter = trpc.router({ .mutation(async ({input: {id: ccfgId}, ctx}) => { const provider = ctx.connectorMap[extractConnectorName(ccfgId)] if (provider?.metadata?.nangoProvider) { - await ctx.nango.delete('/config/{provider_config_key}', { - path: {provider_config_key: ccfgId}, - }) + await ctx.nango + .delete('/config/{provider_config_key}', { + path: {provider_config_key: ccfgId}, + }) + .catch(async (err) => { + await ctx.nango.get('/config/{provider_config_key}', { + path: {provider_config_key: ccfgId}, + query: {}, + }) + // What happens to error case? Do we get 404? Wish openAPI spec specifies this... + throw err + }) } return ctx.services.metaService.tables.connector_config.delete(ccfgId) }),