Skip to content

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

fix: disable logs explorer gracefully

Qiao Han2a6930883843
diff --git a/studio/components/interfaces/Settings/Logs/Logs.constants.ts b/studio/components/interfaces/Settings/Logs/Logs.constants.ts
index f798a345554..0d65ccf9c74 100644
--- a/studio/components/interfaces/Settings/Logs/Logs.constants.ts
+++ b/studio/components/interfaces/Settings/Logs/Logs.constants.ts
@@ -1,5 +1,4 @@
import dayjs from 'dayjs'
-import { IS_PLATFORM } from 'lib/constants'
import { DatetimeHelper, FilterTableSet, LogTemplate } from '.'
export const LOGS_EXPLORER_DOCS_URL =
@@ -666,5 +665,3 @@ export const TIER_QUERY_LIMITS: {
TEAM: { text: '28 days', value: 28, unit: 'day', promptUpgrade: true },
ENTERPRISE: { text: '90 days', value: 90, unit: 'day', promptUpgrade: false },
}
-
-export const SHOW_O11Y = IS_PLATFORM || process.env.NEXT_PUBLIC_ENABLE_LOGS == 'true'
diff --git a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
index 314f5d16569..20904d97129 100644
--- a/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
+++ b/studio/components/layouts/ProjectLayout/NavigationBar/NavigationBar.utils.tsx
@@ -13,7 +13,6 @@ import SVG from 'react-inlinesvg'
import { ProjectBase } from 'types'
import { Route } from 'components/ui/ui.types'
import { BASE_PATH, IS_PLATFORM, PROJECT_STATUS } from 'lib/constants'
-import { SHOW_O11Y } from 'components/interfaces/Settings/Logs'
export const generateToolRoutes = (ref?: string, project?: ProjectBase): Route[] => {
const isProjectBuilding = project?.status === PROJECT_STATUS.COMING_UP
@@ -97,16 +96,12 @@ export const generateOtherRoutes = (ref?: string, project?: ProjectBase): Route[
},
]
: []),
- ...(SHOW_O11Y
- ? [
- {
- key: 'logs',
- label: 'Logs',
- icon: <IconList size={18} strokeWidth={2} />,
- link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/logs/explorer`),
- },
- ]
- : []),
+ {
+ key: 'logs',
+ label: 'Logs',
+ icon: <IconList size={18} strokeWidth={2} />,
+ link: ref && (isProjectBuilding ? buildingUrl : `/project/${ref}/logs/explorer`),
+ },
{
key: 'api',
label: 'API Docs',
diff --git a/studio/pages/api/projects/[ref]/analytics/endpoints/[name].ts b/studio/pages/api/projects/[ref]/analytics/endpoints/[name].ts
index 2b7ab5ec113..b9ab5791bea 100644
--- a/studio/pages/api/projects/[ref]/analytics/endpoints/[name].ts
+++ b/studio/pages/api/projects/[ref]/analytics/endpoints/[name].ts
@@ -10,6 +10,11 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
switch (method) {
case 'GET':
+ if (process.env.NEXT_PUBLIC_ENABLE_LOGS !== 'true') {
+ return res
+ .status(400)
+ .json({ error: { message: '[analytics] is not enabled in supabase/config.toml' } })
+ }
const missingEnvVars = [
process.env.LOGFLARE_API_KEY ? null : 'LOGFLARE_API_KEY',
process.env.LOGFLARE_URL ? null : 'LOGFLARE_URL',