© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•8mo ago•
3 replies
Shanks

Table not returning the required data

I am trying to get a table from the supabase from database biut it is not returning anything.
export async function getAllGames(): Promise<Game[]> {
  const supabase = await createClient();
  const { data, error } = await supabase
    .from('games')
    .select();
    // .order('created_at', { ascending: true });
  if (error) {
    console.error('getAllGames error:', error);
    return [];
  }
  console.log(data);
  return (data || []) as Game[];

}
export async function getAllGames(): Promise<Game[]> {
  const supabase = await createClient();
  const { data, error } = await supabase
    .from('games')
    .select();
    // .order('created_at', { ascending: true });
  if (error) {
    console.error('getAllGames error:', error);
    return [];
  }
  console.log(data);
  return (data || []) as Game[];

}

And this is where I am calling it
useEffect(() => {
        setLoading(true);
        setError(null);
        getAllGames()
            .then((games) => setGames(games))
            .catch((err) => {
                setError('Failed to load games.');
                console.error(err);
            })
            .finally(() => setLoading(false));
    }, []);
useEffect(() => {
        setLoading(true);
        setError(null);
        getAllGames()
            .then((games) => setGames(games))
            .catch((err) => {
                setError('Failed to load games.');
                console.error(err);
            })
            .finally(() => setLoading(false));
    }, []);
I have already populated it but it is not returing anything
DO i have to create some RLS or some other error?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Returning null after data inserted into table
SupabaseSSupabase / help-and-questions
4y ago
Inner join not returning data
SupabaseSSupabase / help-and-questions
13mo ago
Insert not returning new data
SupabaseSSupabase / help-and-questions
4y ago
Supabase query data returning null
SupabaseSSupabase / help-and-questions
4mo ago