© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
4 replies
felsey

42P01 relation public.profiles does not exist

I'm getting an error saying that the relation does not exist when it does.

It happens when I invoke the function.

Here's the code I'm using:

const test = async (req: any) => {
  try {
    // Set the Auth context of the user that called the function.
    // This way your row-level-security (RLS) policies are applied.
    supabaseClient.auth.setAuth(
      req.headers.get("Authorization")!.replace("Bearer ", "")
    );

    const { data, error } = await supabaseClient.from("profiles").select("*");
    console.log({ data, error });

    return new Response(JSON.stringify({ data, error }), {
      headers: { "Content-Type": "application/json" },
      status: 200,
    });
  } catch (error) {
    return new Response(JSON.stringify({ error: error.message }), {
      headers: { "Content-Type": "application/json" },
      status: 400,
    });
  }
};

serve(test);

console.log("hello world");
const test = async (req: any) => {
  try {
    // Set the Auth context of the user that called the function.
    // This way your row-level-security (RLS) policies are applied.
    supabaseClient.auth.setAuth(
      req.headers.get("Authorization")!.replace("Bearer ", "")
    );

    const { data, error } = await supabaseClient.from("profiles").select("*");
    console.log({ data, error });

    return new Response(JSON.stringify({ data, error }), {
      headers: { "Content-Type": "application/json" },
      status: 200,
    });
  } catch (error) {
    return new Response(JSON.stringify({ error: error.message }), {
      headers: { "Content-Type": "application/json" },
      status: 400,
    });
  }
};

serve(test);

console.log("hello world");
Screen_Shot_2022-08-17_at_12.32.23_AM.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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Supabase Flutter app can’t see public.profiles (42P01 “relation does not exist”) though DB is good.
SupabaseSSupabase / help-and-questions
7mo ago
relation "public.users" does not exist
SupabaseSSupabase / help-and-questions
3y ago
getting relation public.profiles does not exist when selecting user data
SupabaseSSupabase / help-and-questions
4y ago
relation 'public.table_name' does not exist
SupabaseSSupabase / help-and-questions
4y ago