Can’t export constants and use “use server” in actions.ts in Next.js
I’m making an app in Next.js and have an actions.ts
file containing all my functions to fetch and add data from my Vercel Postgres store. I want to revalidate the data after these functions, so I added export const revalidate = 1
to revalidate the data. This works, but I also need to set it to use server
because otherwise @vercel/postgres
can’t find the CONNECTION_URL
. But, revalidate
variable doesn’t work with use server
Can’t export constants and use “use server” in actions.ts in Next.js
I’m making an app in Next.js and have an actions.ts
file containing all my functions to fetch and add data from my Vercel Postgres store. I want to revalidate the data after these functions, so I added export const revalidate = 1
to revalidate the data. This works, but I also need to set it to use server
because otherwise @vercel/postgres
can’t find the CONNECTION_URL
. But, revalidate
variable doesn’t work with use server