Multiple Supabase client instances with debug code logging sessions in production
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- next.js, supabase, typescript
- Domain
- authentication, full-stack, security
Research direction
Start by reading src/lib/supabase.ts, src/lib/supabase-admin.ts, src/utils/supabase/server.ts, src/utils/supabase/client.ts, and src/utils/supabase/authActions.ts. Trace which modules import each client and how browser, server, and service-role usage are separated. Done means the debug session logging is gone, the service-role client cannot reach browser code, and the remaining client usage follows one consistent pattern.
Written by the indexing model from the issue text.
Description
Issue
The project has at least 3 separate Supabase client configurations with inconsistent usage:
src/lib/supabase.ts-createBrowserClient(shared, with debug code)src/lib/supabase-admin.ts-createClientwith service role keysrc/utils/supabase/server.ts-createServerClientsrc/utils/supabase/client.ts- Another browser clientsrc/utils/supabase/authActions.ts- Auth-specific client
Why this matters
-
Debug code left in production -
supabase.ts:16-19:supabase.auth.getSession().then(res => { console.log("📦 [supabase.ts] Initial session:", res); }).catch(err => { console.error("❌ [supabase.ts] Session fetch error:", err); });This runs every time the module is imported - on every page load, logging session data to the console.
-
Potential for service role key leaks - If
supabase-admin.tsis ever imported on the client side (even accidentally), theSUPABASE_SERVICE_ROLE_KEYwould be exposed to the browser, giving full database admin access. -
Inconsistent session handling - Different parts of the app use different client instances, which may have different cookie/session states.
Fix
- Remove the debug
getSession()code fromsupabase.ts - Ensure
supabase-admin.tsis only imported in server-side code (useif (typeof window === 'undefined')guard or move to a server-only directory) - Consolidate to a single client factory pattern
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenLake/RateMyCourse
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenLake/RateMyCourse#66 ·
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenLake/RateMyCourse#61 ·
-
advanced bug
Difficulty 3/5 1-2 days Newbie friendliness 48/100
OpenLake/RateMyCourse#59 ·
-
advanced bug enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
OpenLake/RateMyCourse#58 ·
-
help wanted
Difficulty 5/5 Over a week Newbie friendliness 25/100
OpenLake/RateMyCourse#49 · 1 comment ·
All issues in OpenLake/RateMyCourse
Similar issues
-
Browser Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
getsentry/sentry-javascript#24577 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agilepathway/label-checker#640 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
agentic-workflows
Difficulty 1/5 Under an hour Newbie friendliness 85/100
githubnext/rig#534 ·
-
automation missing-model model-sync provider:pioneer
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anomalyco/models.dev#7701 ·