Internal API fetch with getServerSideProps - getSession() in SSR #4741
Labels
enhancement
New feature or request
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Description 📓
According to the Next Auth documentation.
For a page using SSR, I need to use getSession() to get the session.
This causes your internal API (/api/auth/session) to be called. Why are we making a request from the server to the server itself, isn't this unnecessary?
This is an unnecessary, inefficient and expensive approach, as it will result in an additional request due to the execution of getServerSideProps and API Routes on the server.
I propose that we create an additional function suitable for SSR mode only.
How to reproduce ☕️
Contributing 🙌🏽
No, I am afraid I cannot help regarding this
The text was updated successfully, but these errors were encountered: