Closed Alex979 closed 1 year ago
Also just for added context, the functions where I am using the local API are in lib/locations.ts, and I call these functions in my pages, such as in app/gallery/[slug]/page.tsx.
Update: Going to close this since I was able to fix the issue by upgrading to the latest version of Next.JS.
I currently have a site where I statically generate my pages using the Local API with
getPayloadClient
, but whenever my dev environment hot reloads or I manually reload the page, I get the following error:This seems to be an error coming from mongoose related to the schema, but my understanding was that using
getPayloadClient()
was supposed to cache the connection so I'm not sure why this happens on reload.It's tough to reproduce since you need a mongoose database and an s3 bucket configuration for the site to work properly, but I'll link my repository here if you'd like to take a look: https://github.com/Alex979/Krunal-Desai/tree/new-stack
These are the steps to reproduce:
.env
file with a valid mongodb database and amazon s3 bucketnpm run dev
Location
using the Admin UIAny help would be much appreciated! I haven't seen anyone else reporting this error so I'm hoping that I'm just overlooking something here.