Skip to content

Comments

Replace placeholder Supabase credentials with fail-fast error throwing#15

Merged
jomzxc merged 3 commits intodevelopfrom
copilot/sub-pr-14
Nov 6, 2025
Merged

Replace placeholder Supabase credentials with fail-fast error throwing#15
jomzxc merged 3 commits intodevelopfrom
copilot/sub-pr-14

Conversation

Copy link
Contributor

Copilot AI commented Nov 6, 2025

Addresses security risk where missing Supabase environment variables fell back to placeholder values, causing silent runtime failures instead of failing fast.

Changes

Replaced placeholder fallbacks with explicit error throwing in Supabase client initialization:

  • lib/supabase/server.ts - Server client
  • lib/supabase/client.ts - Browser client
  • lib/supabase/middleware.ts - Middleware client

Before/After

// Before: Silent failure with placeholders
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || ""
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || ""

if (!supabaseUrl || !supabaseAnonKey) {
  console.warn("Using placeholder values.")
}

return createServerClient(
  supabaseUrl || "https://placeholder.supabase.co",
  supabaseAnonKey || "placeholder-anon-key",
  // ...
)

// After: Fail fast with clear error
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY

if (!supabaseUrl || !supabaseAnonKey) {
  throw new Error(
    "Missing Supabase environment variables. " +
    "Please set NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY in your environment."
  )
}

return createServerClient(supabaseUrl, supabaseAnonKey, /* ... */)

Build now fails immediately when environment variables are missing, surfacing configuration issues at build time rather than runtime.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link

vercel bot commented Nov 6, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
webdrop Ready Ready Preview Comment Nov 6, 2025 2:35am

Co-authored-by: jomzxc <74537369+jomzxc@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 6, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Copilot AI changed the title [WIP] Update GitHub link and enhance cursor functionality Replace placeholder Supabase credentials with fail-fast error throwing Nov 6, 2025
Copilot AI requested a review from jomzxc November 6, 2025 02:27
Copy link
Owner

@jomzxc jomzxc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@jomzxc jomzxc marked this pull request as ready for review November 6, 2025 02:33
@jomzxc jomzxc merged commit 89c0b02 into develop Nov 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants