I have an api route in my next.js pages app (api/revalidate) for on demand revalidation of the data, and I have set a afterChange hook in a payload collection like this (https://github.com/payloadcms/website-cms/blob/main/src/utilities/regeneratePage.ts).
When my next.js app is on dev server everything works, but when I build and serve the app it don't.
On the build I can go to the url for the revalidation and everything works fine, but for some reason payload can't.
Can someone help me? Thanks