brilliant-limeB
Refine2y ago
8 replies
brilliant-lime

Supabase Environment Variables will not work

I am trying to change the default Supabase client code in Refine to use environment variables stored in either .env or .env.local and no matter how I try, they always remain undefined. Even though this is a recommended change on the Refine docs.

"You can also use environment variables to store your Supabase URL and key. This is a good practice to keep your sensitive information safe."

Code is below. Ran using "npm run dev". File is: supabase-client.ts

import { createClient } from "@refinedev/supabase";

const SUPABASE_URL = process.env.SUPABASE_URL!;
const SUPABASE_KEY = process.env.SUPABASE_KEY!;

export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
db: {
schema: "public",
},
auth: {
persistSession: true,
},
});
Was this page helpful?