AfzalA
Convex Community4w ago
1 reply
Afzal

preloadAuthQuery not working in Nextjs16 + BetterAuth

🔑AuthAdvice
Is there any use of preloadAuthQuery in convex nextjs16 with cacheComponent enabled? As it requires to add Suspense and any way showes loading insteas of instant UI!

For example: In the landing page I want to show Signin/Dashboard button based on userAuth. Now irrespective I have to add Suspens loader. It can be show without that micro sec delay!


## Error Type
Blocking Route

## Error Message
Route "/": Uncached data or `connection()` 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 betterFetch (node_modules/@better-fetch/fetch/src/fetch.ts:76:23)
    at fetchToken (node_modules/@convex-dev/better-auth/src/utils/index.ts:117:22)
    at getToken (node_modules/@convex-dev/better-auth/src/utils/index.ts:134:12)
    at callWithToken (node_modules/@convex-dev/better-auth/src/nextjs/index.ts:87:19)
    at HeaderContainer (app/page.tsx:24:30)
    at Page (app/page.tsx:14:7)

## Code Frame
  74 |
  75 |     const { clearTimeout } = getTimeout(opts, controller);
> 76 |     let response = await fetch(context.url, context);
     |                          ^
  77 |     clearTimeout();
  78 |
  79 |     const responseContext = {

Next.js version: 16.1.6 (Turbopack)
Was this page helpful?