mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-03 20:32:39 +02:00
fix klavis error on project deletion
This commit is contained in:
parent
a79667b401
commit
7c00012fbc
1 changed files with 11 additions and 7 deletions
|
|
@ -14,6 +14,8 @@ import { USE_AUTH } from "../lib/feature_flags";
|
||||||
import { deleteMcpServerInstance, listActiveServerInstances } from "./klavis_actions";
|
import { deleteMcpServerInstance, listActiveServerInstances } from "./klavis_actions";
|
||||||
import { authorizeUserAction } from "./billing_actions";
|
import { authorizeUserAction } from "./billing_actions";
|
||||||
|
|
||||||
|
const KLAVIS_API_KEY = process.env.KLAVIS_API_KEY || '';
|
||||||
|
|
||||||
export async function projectAuthCheck(projectId: string) {
|
export async function projectAuthCheck(projectId: string) {
|
||||||
if (!USE_AUTH) {
|
if (!USE_AUTH) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -224,6 +226,7 @@ export async function deleteProject(projectId: string) {
|
||||||
await projectAuthCheck(projectId);
|
await projectAuthCheck(projectId);
|
||||||
|
|
||||||
// First cleanup any Klavis instances
|
// First cleanup any Klavis instances
|
||||||
|
if (KLAVIS_API_KEY) {
|
||||||
const deletionErrors = await cleanupMcpServers(projectId);
|
const deletionErrors = await cleanupMcpServers(projectId);
|
||||||
|
|
||||||
// If there were any errors deleting instances, throw an error
|
// If there were any errors deleting instances, throw an error
|
||||||
|
|
@ -231,6 +234,7 @@ export async function deleteProject(projectId: string) {
|
||||||
const failedServers = deletionErrors.map(e => `${e.serverName} (${e.error})`).join(', ');
|
const failedServers = deletionErrors.map(e => `${e.serverName} (${e.error})`).join(', ');
|
||||||
throw new Error(`Cannot delete project because the following Klavis instances could not be deleted: ${failedServers}. Please try again or contact support if the issue persists.`);
|
throw new Error(`Cannot delete project because the following Klavis instances could not be deleted: ${failedServers}. Please try again or contact support if the issue persists.`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// delete api keys
|
// delete api keys
|
||||||
await apiKeysCollection.deleteMany({
|
await apiKeysCollection.deleteMany({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue