Next.js Discord

Discord Forum

Error when build on vercel and local

Unanswered
Barbary Lion posted this in #help-forum
Open in Discord
Avatar
Barbary LionOP
Nextjs app route
Code : github.com/Rizky-Pratama/e-library
Image
Image
Image
Image

11 Replies

Avatar
Ray
you can't call the route handler at build time
just run the db operation on server component
use route segment config or unstable_cache to config the cache
Avatar
Barbary LionOP
Is just adding ?

export const dynamic = 'error'
export const revalidate = false
export const fetchCache = 'force-cahce'
In
/(auth)/signout/page
/(create)/add/book/page
/(create)/add/transaction/page
/(dashboard)/dashboard/books/page
/(dashboard)/dashboard/category/page
/(dashboard)/dashboard/page
/(dashboard)/dashboard/staff/page
/(dashboard)/dashboard/transaction/page
/(dashboard)/dashboard/users/page
Avatar
Ray
do you want those page cached or not?
Avatar
Barbary LionOP
Yes
Avatar
Ray
ok it should work then use revalidatePath to revalidate the cache when you need it
Avatar
Barbary LionOP
Thanks @Ray