make sure you're using the page router because the getServerSideProps
only works in the page router due NextJS official documentation:
https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props
if you want to use the app router you can check data fetching section here: https://nextjs.org/docs/app/building-your-application/data-fetching