diff --git a/packages/server/src/api/controllers/auth.ts b/packages/server/src/api/controllers/auth.ts index 6aab688c30..0742583a8d 100644 --- a/packages/server/src/api/controllers/auth.ts +++ b/packages/server/src/api/controllers/auth.ts @@ -2,7 +2,7 @@ import { outputProcessing } from "../../utilities/rowProcessor" import { InternalTables } from "../../db/utils" import { getFullUser } from "../../utilities/users" import { roles, context, db as dbCore } from "@budibase/backend-core" -import { AppSelfResponse, ContextUser, Row, UserCtx } from "@budibase/types" +import { AppSelfResponse, ContextUser, UserCtx } from "@budibase/types" import sdk from "../../sdk" import { processUser } from "../../utilities/global" @@ -45,7 +45,7 @@ export async function fetchSelf(ctx: UserCtx) { try { const userTable = await sdk.tables.getTable(InternalTables.USER_METADATA) // specifically needs to make sure is enriched - ctx.body = (await outputProcessing(userTable, user as Row)) as ContextUser + ctx.body = await outputProcessing(userTable, user) } catch (err: any) { let response: ContextUser | {} // user didn't exist in app, don't pretend they do diff --git a/packages/server/src/api/controllers/deploy/index.ts b/packages/server/src/api/controllers/deploy/index.ts index 652086f571..b05b82d79a 100644 --- a/packages/server/src/api/controllers/deploy/index.ts +++ b/packages/server/src/api/controllers/deploy/index.ts @@ -126,6 +126,9 @@ export async function deploymentProgress( try { const db = context.getAppDB() const deploymentDoc = await db.get(DocumentType.DEPLOYMENTS) + if (!deploymentDoc.history?.[ctx.params.deploymentId]) { + ctx.throw(404, "No deployment found") + } ctx.body = deploymentDoc.history?.[ctx.params.deploymentId] } catch (err) { ctx.throw( diff --git a/packages/types/src/api/web/deployment.ts b/packages/types/src/api/web/deployment.ts index 9e4caccc24..f5ed9242b1 100644 --- a/packages/types/src/api/web/deployment.ts +++ b/packages/types/src/api/web/deployment.ts @@ -2,13 +2,11 @@ import { DeploymentDoc, DeploymentStatus } from "../../documents" export interface PublishAppResponse extends DeploymentDoc {} -export type DeploymentProgressResponse = - | { - _id: string - appId: string - status?: DeploymentStatus - updatedAt: number - } - | undefined +export interface DeploymentProgressResponse { + _id: string + appId: string + status?: DeploymentStatus + updatedAt: number +} export type FetchDeploymentResponse = DeploymentProgressResponse[]