I'm crafting a Trello clone with Next.js and Supabase as a BaaS.
In my Supabase table I have this policies:
Policies are working grate on client side with the following code:
const { data } = await supabase
.from<BoardType>('board')
.select('*')
.eq('id', board.id)
.single();
but when I try to get the board info on getServerSideProps
it doesn't work, it return null all the time. I know that, for example, if you want to get the authenticated user on server side, you have to use supabase.auth.api.getUserByCookie(context.req)
so I don't know if there's something I'm missing, but I couldn't find anything related to that.
Does anyone know how to handle that?
[Edited]
Here is the getServerSideProps
code:
export const getServerSideProps: GetServerSideProps<BoardSlugProps> = async ({
query,
}) => {
const { data } = await supabase
.from<BoardType>('board')
.select('*')
.eq('id', query.slug as string)
.single();
console.log(data);
return {
props: {
board: data,
},
};
};