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");
Screen_Shot_2022-08-17_at_12.32.23_AM.png
Was this page helpful?