SupabaseS
Supabase2y ago
Rina

Data not fetching on build

Hello all, I am a learner trying to deploy my project using Node.js React Vite and Supabase.

My data fetch is working on development. but when I build with npm run build data fetch does not work and not seeing any error code.
I did follow https://supabase.com/docs/guides/getting-started/tutorials/with-react


require("dotenv").config({
  path: "./.env.local",
});

const supabaseUrl = process.env.VITE_SUPABASE_URL;
const supabaseKey = process.env.VITE_SUPABASE_ANON_KEY;

const { createClient } = require("@supabase/supabase-js");

const supabase = createClient(supabaseUrl, supabaseKey);

module.exports = supabase;


This is my supabase server file and I have the url and key in .env.local in the root folder.
I appreciate your help.
Learn how to use Supabase in your React App.
Was this page helpful?