You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I tryed to deploy the code to vercel I got this error:
Generating static pages (1/9) [== ]Error fetching session: n [Error]: Dynamic server usage: Route / couldn't be rendered statically because it used headers. See more info here: https://nextjs.org/docs/messages/dynamic-server-error
at l (C:\Codes\tapiceria\tapiceria-hk.next\server\chunks\948.js:1:37247)
at d (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:96:2565)
at s (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:95:20300)
at m (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:110:85375)
at g (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:110:85487)
at eh (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:134786)
at e (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:137671)
at ek (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:138145)
at Array.toJSON (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:135755)
at stringify () {
description: "Route / couldn't be rendered statically because it used headers. See more info here: https://nextjs.org/docs/messages/dynamic-server-error",
digest: 'DYNAMIC_SERVER_USAGE'
The text was updated successfully, but these errors were encountered:
This error occurs because, by default, Next.js (from version 13, with App Router) tries to generate static routes (SSG). However, your "/" route is using some resource that requires dynamic rendering on the server (e.g.: fetching a session with next-auth, reading cookies, calling a database, etc.). When this occurs, Next.js reports “Dynamic server usage” and cannot create the page statically at build time.
Use this code in page.tsx:
export const dynamic = 'force-dynamic';
// Your code that gets the session...
import { getServerSession } from 'next-auth';
When I tryed to deploy the code to vercel I got this error:
Generating static pages (1/9) [== ]Error fetching session: n [Error]: Dynamic server usage: Route / couldn't be rendered statically because it used
headers
. See more info here: https://nextjs.org/docs/messages/dynamic-server-errorat l (C:\Codes\tapiceria\tapiceria-hk.next\server\chunks\948.js:1:37247)
at d (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:96:2565)
at s (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:95:20300)
at m (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:110:85375)
at g (C:\Codes\tapiceria\tapiceria-hk.next\server\app(lobby)\page.js:110:85487)
at eh (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:134786)
at e (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:137671)
at ek (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:138145)
at Array.toJSON (C:\Codes\tapiceria\tapiceria-hk\node_modules\next\dist\compiled\next-server\app-page.runtime.prod.js:12:135755)
at stringify () {
description: "Route / couldn't be rendered statically because it used
headers
. See more info here: https://nextjs.org/docs/messages/dynamic-server-error",digest: 'DYNAMIC_SERVER_USAGE'
The text was updated successfully, but these errors were encountered: