I need to pre-fetch authentication status from the server.
When I include getServerSideProps the page returns 500 in production (Vercel), but runs perfectly in development (localhost).
When I remove getServerSideProps everything works well.
import { createPagesServerClient } from "@supabase/auth-helpers-nextjs";
import { GetServerSideProps } from "next";
const Dashboard = () => {
return (
<div>
// content
</div>
);
};
export const getServerSideProps: GetServerSideProps = (async (ctx) => {
try {
return {
props: {},
};
} catch (error) {
console.error('Error fetching data:', error);
return {
props: {
error: error,
},
};
}
});
export default Dashboard;