Back

SSR Dynamic server usage NextJs

  • 0
  • Self Hosted
  • Web
dev_goran
30 Aug, 2024, 12:58

Hi I have problem on build application that show me this error Route /profile couldn't be rendered statically because it used cookies. See more info here: https://nextjs.org/docs/messages/dynamic-server-error", pr:build: digest: 'DYNAMIC_SERVER_USAGE I use like is in example of demo SSR nextjs just for different page export default async function ProfilePage() { const user = await getLoggedInUser() return ( <ProfileView name={user?.name} email={user.email} />) Are someone have same problem?

TL;DR
Developers upgraded Next.js to version 14.2.6, encountering an issue with a ProfilePage component when trying to redirect users if not logged in. ProfileView is a client component. The solution may involve debugging the code for the /profile route and considering any Next.js version-specific impacts on server-side rendering.
Guille
30 Aug, 2024, 19:59

That seems to be a next.js problem. What version of next.js are you using? can you show the code of /profile?

dev_goran
2 Sep, 2024, 06:52

"next": "^14.2.6" and here is profile ```export default async function ProfilePage() { const user = await getLoggedInUser()

if (!user) redirect('/login') return ( <> <ProfileView name={user?.name} email={user.email}> <h4 className="text-white font-mono">Overview Page</h4> </ProfileView> </> ) } ``` ProfileView is client component

dev_goran
2 Sep, 2024, 10:00

I change to "next": "^14.1.3 " and its working so yes nextJS problem

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more