Describe the Bug
Calling revalidation functions in the jobs queue like this:
import type { TaskConfig } from 'payload'
import { revalidatePath } from 'next/cache'
export const updateFeeds: TaskConfig<'updateFeeds'> = {
slug: 'updateFeeds',
handler: async () => {
try {
revalidatePath(`${process.env.NEXT_PUBLIC_BACKEND_URL}/feed.xml`)
return {
state: 'succeeded',
output: null,
}
} catch (error) {
return {
state: 'failed',
output: null,
}
}
},
}
Produces an error:
Route /admin/[[...segments]] used "revalidatePath /feed/google" during render which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering
I think a workaround is to call create an API endpoint for the revalidation and call that in the task.
Link to the code that reproduces this issue
https://github.com/linobino1/repro-payload-revalidate-in-jobs
Reproduction Steps
pnpm build
pnpm start
- hit
http://localhost:3000
- the job should be picked up within 60s
- check console for error logs
Which area(s) are affected?
area: core
Environment Info
Binaries:
Node: 25.9.0
npm: 11.12.1
Yarn: N/A
pnpm: 10.33.2
Relevant Packages:
payload: 3.84.1
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:46 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 8
Describe the Bug
Calling revalidation functions in the jobs queue like this:
Produces an error:
Route /admin/[[...segments]] used "revalidatePath /feed/google" during render which is unsupported. To ensure revalidation is performed consistently it must always happen outside of renders and cached functions. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-renderingI think a workaround is to call create an API endpoint for the revalidation and call that in the task.
Link to the code that reproduces this issue
https://github.com/linobino1/repro-payload-revalidate-in-jobs
Reproduction Steps
pnpm buildpnpm starthttp://localhost:3000Which area(s) are affected?
area: core
Environment Info