supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
2.83k stars 219 forks source link

List all users (auth schema) not working with local environment #1007

Open Tahaaskari97 opened 1 month ago

Tahaaskari97 commented 1 month ago

When attempting to load all users from the auth schema using the provided code snippet, the expected behavior is to fetch users from the Supabase environment. However, it appears that the code functions properly in the production environment but fails to retrieve users in the local environment.

useEffect(() => {
    const getUsers = async () => {
      const {
        data: { users },
        error,
      } = await supabase.auth.admin.listUsers();
    console.log({ users });
    };
    getUsers();
  }, []);

Upon investigation, the code block utilizing await supabase.auth.admin.listUsers() is intended to fetch users. However, in the local environment, it does not yield the expected results.

Tananga commented 3 weeks ago

Are you using "service_role" key or just "anon"?

Tahaaskari97 commented 2 weeks ago

Are you using "service_role" key or just "anon"?

@Tananga yes I am using service_key_role