Next.js Discord

Discord Forum

"use cache"

Answered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
in all my pages I verifying the session of the user with the cookies and now that I enabled cache compoent I get:

## Error Type
Blocking Route

## Error Message
Route "/project": Uncached data was accessed outside of <Suspense>. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route


    at AppHomePage (src/app/(app)/project/page.tsx:17:38)
    at LogSafely (<anonymous>:null:null)

## Code Frame
  15 | export default async function AppHomePage() {
  16 |   // Check if user is authenticated and already a member
> 17 |   const session = await verifySession();
     |                                      ^
  18 |
  19 |   if (session?.user && !session?.user.isProfileComplete) return redirect("/");
  20 |

Next.js version: 16.0.7 (Turbopack)
Answered by B33fb0n3
you need to add loading.tsx to your pages so they appear instantly. For private caching data from dynamic functions like cookies, you can use use cache: private ([see more](https://nextjs.org/docs/app/api-reference/directives/use-cache-private)). For none use related data use use cache directive.

Independed of that: your project is vulnable to [CVE-2025-55184 & CVE-2025-55183](https://nextjs.org/blog/security-update-2025-12-11). You want to fix those asap by upgrading to 16.0.10
View full answer

7 Replies

Answer
Transvaal lionOP
thanks but should I cache the session? or not?
@B33fb0n3
@Transvaal lion thanks but should I cache the session? or not?
I wouldn't.
1. use cache: private is experimental
2. what if the session is now invalid? The user would still have access to the cached data
Transvaal lionOP
you are right
thanks so much for your help!
happy to help