From 80f82a8a606127f5b1b328aba8548ce84ec92089 Mon Sep 17 00:00:00 2001 From: Chandraveer Date: Thu, 12 Mar 2026 15:21:30 +0530 Subject: [PATCH 1/2] fix: crash when deployment not found in logs viewer --- src/logs.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/logs.ts b/src/logs.ts index 178710e..3d14afb 100644 --- a/src/logs.ts +++ b/src/logs.ts @@ -27,12 +27,19 @@ const showLogs = async ( let logsTill: string[] = ['']; - let app: Deployment; + let app: Deployment | undefined; let status: DeployStatus = 'create'; while (status !== 'ready') { - app = (await api.inspect()).filter(dep => dep.suffix === suffix)[0]; + const deployments = (await api.inspect()).filter( + dep => dep.suffix === suffix + ); + + if (deployments.length === 0) { + error(`Deployment with suffix "${suffix}" not found`); + } + app = deployments[0]; status = app.status; const prefix = app.prefix; From e54a1866461cb68f144e96141ee8a439dee99b13 Mon Sep 17 00:00:00 2001 From: Chandraveer Date: Thu, 12 Mar 2026 19:18:07 +0530 Subject: [PATCH 2/2] fix: crash when selected deployment not found in delete flow --- src/delete.ts | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/delete.ts b/src/delete.ts index 7bde802..79406ab 100644 --- a/src/delete.ts +++ b/src/delete.ts @@ -35,16 +35,28 @@ export const deleteBySelection = async (api: APIInterface): Promise => { 'Select the deployment to delete:' ); - const app = deployments.filter( - dep => - dep.suffix === project.split(' ')[0] && - dep.version === project.split(' ')[1] - )[0]; + // Parse the selected project string + const parts = project.split(' '); + const selectedSuffix = parts[0]; + const selectedVersion = parts[1]; + + if (!selectedSuffix || !selectedVersion) { + error('Invalid deployment selection format'); + } + + // Find the matching deployment + const app = deployments.find( + dep => dep.suffix === selectedSuffix && dep.version === selectedVersion + ); + + if (!app) { + error( + 'Selected deployment not found. It may have been deleted already.' + ); + } info(await del(app.prefix, app.suffix, app.version, api)); } catch (err) { error(String(err)); } }; - -// This can be better