Hey there! Does any of you ever had a problem with...
# help
p
Hey there! Does any of you ever had a problem with a table policy like (uid() = user_id) only on server side? It works on client side but returns empty on server side. I think I'm missing something here but I can't figure out what. Here's the code:
Copy code
typescript
export const getAllBoards = async () => {
  const { data, error } = await supabase.from<BoardType>('board').select('*');
  if (error) {
    console.log(error);
    return [];
  }
  return data;
};
And here's my
getServerSideProps
Copy code
typescript
export const getServerSideProps: GetServerSideProps = async (context) => {
  const { user } = await supabase.auth.api.getUserByCookie(context.req);
  if (user) {
    const boards = await getAllBoards();
    return {
      props: {
        _boards: boards,
      },
    };
  }
  return {
    props: {
      _boards: [],
    },
  };
};
s
Are you using the anon key for your requests or are you using the service key?
p
the anon key