Edge Function + Google Cloud Integration Issues
Hey everyone 👋
I’m building a SaaS for PDF document processing — files are uploaded to Supabase Storage, processed via Google Cloud Vision + Vertex AI (GCP), and structured into Supabase tables.
Running locally in Cursor on localhost.
⚙️ Setup
Function: process-document
Region: europe-west3 (Frankfurt)
Goal: OCR + AI parsing → structured Excel-like data
✅ Fixed Issues
1️⃣ req.json() called twice → fixed
2️⃣ GCP credentials JSON quotes → fixed
supabase secrets set GOOGLE_APPLICATION_CREDENTIALS="$(cat service-account-key.json)"
3️⃣ Storage RLS for service_role → fixed
❌ Current Problem
Function runs but returns:
FunctionsHttpError: Edge Function returned a non-2xx status code
500 Internal Server Error
No detailed logs shown — can’t see root cause.
💡 Questions
1️⃣ How to view detailed Edge Function logs for 500 errors?
2️⃣ Best practice for GCP service account keys inside Edge Functions?
3️⃣ Proper RLS setup for file downloads via service_role?
4️⃣ Handling large PDFs / long OCR+LLM tasks — stay in Edge or use Cloud Run / queues?
5️⃣ Can GCP directly insert processed data into Supabase tables, or must it go via API / Cloud Function?
5 Replies
1) You should be able to see edge function logs in the dashboard for errors https://supabase.com/dashboard/project/_/logs/edge-functions-logs.
or check your actual edge function, it will have a logs tab

2) Best practice for all secret keys i would say is to store them as secrets and fetch them using Deno.env.get(<secret>)
3) Service role key bypasses all RLS so if you are planning to use that then you don't have to worry about RLS (use it only in secure server side environments)
4) Edge function are not suitable for processes that are long running, have high CPU usage or high memory, see edge function limits here -> https://supabase.com/docs/guides/functions/limits
Limits | Supabase Docs
Limits applied Edge Functions in Supabase's hosted platform.
5) I don't know much about GCP but if it let's you create a supabase javascript client using the service role key, then you should be able to insert directly into your database from there (i might need more information for this point to give a better answer)