---
title: "Discussion on \"Why useSession() Is undefined on First Load in Next.js When Deployed to Production (and how i fixed it)\" | Hashnode"
description: "Discussion on \"Why useSession() Is undefined on First Load in Next.js When Deployed to Production (and how i fixed it)\". When i Deployed my Saas (next.js app) in production i noticed something strange. On the first load my console showed session undefined but when i refreshed the page ie /dashboard everything worked perfectly.\nEven More Confusing that this never happen..."
url: "https://hashnode.com/posts/why-usesession-is-undefined-on-first-load-in-nextjs-when-deployed-to-production-and-how-i-fixed-it/6968034cf062199067ccd611"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Why useSession() Is undefined on First Load in Next.js When Deployed to Production (and how i fixed it)](https://athashricodes.hashnode.dev/why-usesession-is-undefined-on-first-load-in-nextjs-when-deployed-to-production-and-how-i-fixed-it?utm_source=hashnode&utm_medium=feed)

When i Deployed my Saas (next.js app) in production i noticed something strange. On the first load my console showed session undefined but when i refreshed the page ie /dashboard everything worked perfectly. Even More Confusing that this never happen...

Jan 14 · 2 min read · athashricodes.hashnode.dev  
Read the article

-   [#debugging](https://hashnode.com/tag/debugging)
-   [#nextauthjs](https://hashnode.com/tag/nextauthjs)
-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#vercel](https://hashnode.com/tag/vercel)
-   [#full-stack-development](https://hashnode.com/tag/full-stack-development)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Athashri Keny](https://hashnode.com/@athashrik)

@athashrik · mumbai , maharashtra

  
[View profile](https://hashnode.com/@athashrik)

Full stack web developer

As a passionate Third-year Computer Science student, I specialize in creating engaging web experiences using modern technologies. My focus is on building accessible, and performant applications.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
