Except getServerSideProps is no longer used in Next 13 and actually you have no simple access to the request object anymore. Have to write middleware for everything, it is extremely frustrating
To clarify -- using getServerSideProps works for routes defined in the pages/ directory in Next 13, but not for routes defined in the app/ directory. Both pages and app are still fully supported in Next 13. See https://nextjs.org/docs/app/building-your-application/routin...
Yeah which honestly I don't mind the middleware approach for authentication although the route matching is pretty bad for fine grain control.
However another thing is the middleware is all through the edge runtime. So things like regular postgres drivers don't work (although I did hear that Cloudflare workers added TCP so maybe that's coming).
I will say Planetscale and the hottest db as a service platforms all seem to have an edge adapter to allow for this but your SOL otherwise.
Yes, I tried making a middleware for auth, but it just was not working for me. I think I had trouble passing along information to the actual page or something. I also was unable to have my login page handle authentication to set the cookie so I had to do go and make an API for it. I eventually cut my losses and gave up since it felt like my app was going against the grain.