session null in nextjs route handler
I know auth and sessions is working because it I can log in and out with no problem. My server functions are able to get sessions but whenever I try and get the session from a route handler it's null
This same function is used throughout my app and works everywhere except route handlers
4 Replies
I found the fix. You have to pass the headers to the api call inside of your server component
Can you show how you passed the headers please. Is it just doing the same await headers and then passing that to the api call in your server component?
sorry just seeing this. When I call the api inside of a server action I just pass the headers
Yeah that is what I ended up doing and it worked as well.
Thank you so much