The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add handling for missing env vars for logflare
TzeYiing881bfb98a712
diff --git a/docker/.env.example b/docker/.env.exampleindex 130033409fc..6d101403b72 100644--- a/docker/.env.example+++ b/docker/.env.example@@ -80,4 +80,5 @@ SUPABASE_PUBLIC_URL=http://localhost:8000IMGPROXY_ENABLE_WEBP_DETECTION=true# Configure Logflare API Calls-LOGFLARE_API_KEY=api-key\ No newline at end of file+LOGFLARE_API_KEY=api-key+LOGFLARE_URL=http://localhost:54328\ No newline at end of filediff --git a/studio/.env b/studio/.envindex de7b6e0e4c1..236f623b6f9 100644--- a/studio/.env+++ b/studio/.env@@ -11,6 +11,7 @@ SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICSENTRY_IGNORE_API_RESOLUTION_ERROR=1LOGFLARE_URL:http://localhost:54329LOGFLARE_API_KEY=api-key+LOGFLARE_URL=http://localhost:54329# TODO: evaluate these variables at runtime instead# https://nextjs.org/docs/basic-features/environment-variables#loading-environment-variablesNEXT_PUBLIC_SITE_URL=http://localhost:3000diff --git a/studio/pages/api/projects/[ref]/analytics/endpoints/[name].ts b/studio/pages/api/projects/[ref]/analytics/endpoints/[name].tsindex 3eab72207ca..0b297ec924b 100644--- a/studio/pages/api/projects/[ref]/analytics/endpoints/[name].ts+++ b/studio/pages/api/projects/[ref]/analytics/endpoints/[name].ts@@ -10,9 +10,19 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {switch (method) {case 'GET':- console.log(req)- const result = await proxyRequest(req)- return res.status(200).json(result)+ const missingEnvVars = [+ process.env.LOGFLARE_API_KEY ? null : 'LOGFLARE_API_KEY',+ process.env.LOGFLARE_URL ? null : 'LOGFLARE_URL',+ ].filter((v) => v)+ if (missingEnvVars.length == 0) {+ const result = await proxyRequest(req)+ return res.status(200).json(result)+ } else {+ return res+ .status(500)+ .json({ error: { message: `${missingEnvVars.join(', ')} env variables are not set` } })+ }+default:res.setHeader('Allow', ['GET'])res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })@@ -26,7 +36,7 @@ const proxyRequest = async (req: NextApiRequest) => {const apiKey = process.env.LOGFLARE_API_KEYconsole.log('api key', apiKey)console.log('PROJECT_ANALYTICS_URL', PROJECT_ANALYTICS_URL)- const url = `${PROJECT_ANALYTICS_URL}api/endpoints/query/name/${name}${search}`+ const url = `${PROJECT_ANALYTICS_URL}endpoints/query/name/${name}${search}`console.log('url', url)const result = await get(url, {headers: {