The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix(studio): cap errors-since-last-deploy log range to 24h DEBUG-173 (#47911)
Jordi Enric74c75c6d3a1c
diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.tsx b/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.tsxindex 8333ec6445a..9233c5e4edb 100644--- a/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.tsx+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.tsx@@ -204,7 +204,7 @@ export const EdgeFunctionRecentErrors = ({<div className="flex flex-col gap-6"><PageSectionMeta><PageSectionSummary>- <PageSectionTitle>Errors since last deploy</PageSectionTitle>+ <PageSectionTitle>Errors in the last 24h</PageSectionTitle></PageSectionSummary><PageSectionAside><Buttondiff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.test.ts b/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.test.tsindex 6486cd69e1b..dc3d35d9df4 100644--- a/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.test.ts+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.test.ts@@ -107,6 +107,13 @@ limit 25`)})expect(getSinceLastDeployLogRange()).toEqual({})++ expect(getSinceLastDeployLogRange('2026-03-18T00:00:00.000Z')).toEqual({+ isoTimestampStart: '2026-03-19T12:00:00.000Z',+ isoTimestampEnd: '2026-03-20T12:00:00.000Z',+ })++ vi.useRealTimers()})it('builds the since-deploy invocation count query and empty-state message', () => {diff --git a/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.ts b/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.tsindex a52fa09cdb4..4fe81af6f92 100644--- a/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.ts+++ b/apps/studio/components/interfaces/Functions/EdgeFunctionOverview/EdgeFunctionRecentErrors.utils.ts@@ -127,17 +127,21 @@ export const toIsoTimestamp = (value?: string | number) => {return Number.isNaN(date.valueOf()) ? undefined : date.toISOString()}+export const SINCE_LAST_DEPLOY_MAX_RANGE_MS = 24 * 60 * 60 * 1000+export const getSinceLastDeployLogRange = (updatedAt?: string | number, now: Date = new Date()) => {const isoTimestampStart = toIsoTimestamp(updatedAt)if (!isoTimestampStart) return {}const startDate = new Date(isoTimestampStart)const normalizedNow = new Date(now)- const endDate = Number.isNaN(normalizedNow.valueOf()) ? new Date() : normalizedNow+ const nowDate = Number.isNaN(normalizedNow.valueOf()) ? new Date() : normalizedNow+ const endDate = new Date(Math.max(startDate.valueOf(), nowDate.valueOf()))+ const earliestAllowedStart = endDate.valueOf() - SINCE_LAST_DEPLOY_MAX_RANGE_MSreturn {- isoTimestampStart,- isoTimestampEnd: new Date(Math.max(startDate.valueOf(), endDate.valueOf())).toISOString(),+ isoTimestampStart: new Date(Math.max(startDate.valueOf(), earliestAllowedStart)).toISOString(),+ isoTimestampEnd: endDate.toISOString(),}}