© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
5 replies
J

query returns empty array

(not fluent in english)

im trying to rebuild my svelte project using nextjs and i was using supabase for my backend before so i thought, why not do the same? i used
npx create-next-app -e with-supabase
npx create-next-app -e with-supabase
and started tested things out. for context, i used RLS to all my tables.

i experimented with the auth first so i signed up and signed in.

// ...
import { createClient } from "@/utils/supabase/server";

export default async function AuthSection() {
  const supabaseServer = await createClient();

  const {
    data: { user }, // works fine
  } = await supabaseServer.auth.getUser();

  // ...

  return user ? (
    <UserDropdownMenu />
  ) : (
    <div className="flex gap-2">
      ...
    </div>
  );
}
// ...
import { createClient } from "@/utils/supabase/server";

export default async function AuthSection() {
  const supabaseServer = await createClient();

  const {
    data: { user }, // works fine
  } = await supabaseServer.auth.getUser();

  // ...

  return user ? (
    <UserDropdownMenu />
  ) : (
    <div className="flex gap-2">
      ...
    </div>
  );
}


but when i tried this:

import { createClient } from "@/utils/supabase/client";
import React from "react";

export default async function SampleData() {
  const supabase = createClient();

    let { data: StudentMoodData, error } = await supabase
  .from('StudentMoodEntries')
  .select('*')
          
  return <div>{JSON.stringify(StudentMoodData)}</div>;
}
import { createClient } from "@/utils/supabase/client";
import React from "react";

export default async function SampleData() {
  const supabase = createClient();

    let { data: StudentMoodData, error } = await supabase
  .from('StudentMoodEntries')
  .select('*')
          
  return <div>{JSON.stringify(StudentMoodData)}</div>;
}


it just returns an empty array. i figured it has something to do with policies so i went and check my policy on this table:

alter policy "SELECT"
on "public"."StudentMoodEntries"
to authenticated
using (
  true
);
alter policy "SELECT"
on "public"."StudentMoodEntries"
to authenticated
using (
  true
);


i also logged my user:
{
    "id": "xxx",
    "aud": "authenticated",
    "role": "authenticated",
    "email": "rxxx@gmail.com",
    // ...
}
{
    "id": "xxx",
    "aud": "authenticated",
    "role": "authenticated",
    "email": "rxxx@gmail.com",
    // ...
}


what am i missing?
image.png
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

many-to-many returns empty array
SupabaseSSupabase / help-and-questions
13mo ago
Receiving empty array from query
SupabaseSSupabase / help-and-questions
8mo ago
Empty query back.
SupabaseSSupabase / help-and-questions
4y ago
Empty array as response
SupabaseSSupabase / help-and-questions
4y ago