Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: converts to POST for queries for unified logs (#36596)

Jonathan Summers-Muir8bc3087a115f
diff --git a/apps/studio/data/logs/unified-logs-chart-query.ts b/apps/studio/data/logs/unified-logs-chart-query.ts
index a04765b7e2e..de215cf36ea 100644
--- a/apps/studio/data/logs/unified-logs-chart-query.ts
+++ b/apps/studio/data/logs/unified-logs-chart-query.ts
@@ -1,7 +1,7 @@
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { getLogsChartQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries'
-import { get, handleError } from 'data/fetchers'
+import { handleError, post } from 'data/fetchers'
import { ExecuteSqlError } from 'data/sql/execute-sql-query'
import { logsKeys } from './keys'
import { UNIFIED_LOGS_STALE_TIME, UnifiedLogsVariables } from './unified-logs-infinite-query'
@@ -36,16 +36,9 @@ export async function getUnifiedLogsChart(
// Get SQL query from utility function (with dynamic bucketing)
const sql = getLogsChartQuery(search)
- const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
- params: {
- path: { ref: projectRef },
- query: {
- iso_timestamp_start: dateStart,
- iso_timestamp_end: dateEnd,
- project: projectRef,
- sql,
- },
- },
+ const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
+ params: { path: { ref: projectRef } },
+ body: { sql, iso_timestamp_start: dateStart, iso_timestamp_end: dateEnd },
signal,
})
diff --git a/apps/studio/data/logs/unified-logs-count-query.ts b/apps/studio/data/logs/unified-logs-count-query.ts
index 63356d3089e..cca71aa39fc 100644
--- a/apps/studio/data/logs/unified-logs-count-query.ts
+++ b/apps/studio/data/logs/unified-logs-count-query.ts
@@ -2,7 +2,7 @@ import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { getLogsCountQuery } from 'components/interfaces/UnifiedLogs/UnifiedLogs.queries'
import { FacetMetadataSchema } from 'components/interfaces/UnifiedLogs/UnifiedLogs.schema'
-import { get, handleError } from 'data/fetchers'
+import { handleError, post } from 'data/fetchers'
import { ExecuteSqlError } from 'data/sql/execute-sql-query'
import { logsKeys } from './keys'
import {
@@ -22,17 +22,9 @@ export async function getUnifiedLogsCount(
const sql = getLogsCountQuery(search)
const { isoTimestampStart, isoTimestampEnd } = getUnifiedLogsISOStartEnd(search)
- const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
- params: {
- path: { ref: projectRef },
- query: {
- iso_timestamp_start: isoTimestampStart,
- iso_timestamp_end: isoTimestampEnd,
- project: projectRef,
- sql,
- },
- },
- // body: { sql },
+ const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
+ params: { path: { ref: projectRef } },
+ body: { iso_timestamp_start: isoTimestampStart, iso_timestamp_end: isoTimestampEnd, sql },
signal,
})
diff --git a/apps/studio/data/logs/unified-logs-infinite-query.ts b/apps/studio/data/logs/unified-logs-infinite-query.ts
index 95e6a70335d..c7afe83a21d 100644
--- a/apps/studio/data/logs/unified-logs-infinite-query.ts
+++ b/apps/studio/data/logs/unified-logs-infinite-query.ts
@@ -5,7 +5,7 @@ import {
PageParam,
QuerySearchParamsType,
} from 'components/interfaces/UnifiedLogs/UnifiedLogs.types'
-import { get, handleError } from 'data/fetchers'
+import { handleError, post } from 'data/fetchers'
import { ResponseError } from 'types'
import { logsKeys } from './keys'
@@ -77,17 +77,9 @@ async function getUnifiedLogs(
timestampEnd = isoTimestampEnd
}
- const { data, error } = await get(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
- params: {
- path: { ref: projectRef },
- query: {
- iso_timestamp_start: timestampStart,
- iso_timestamp_end: timestampEnd,
- project: projectRef,
- sql,
- },
- },
- // body: { sql },
+ const { data, error } = await post(`/platform/projects/{ref}/analytics/endpoints/logs.all`, {
+ params: { path: { ref: projectRef } },
+ body: { iso_timestamp_start: timestampStart, iso_timestamp_end: timestampEnd, sql },
signal,
})