payloadcms / payloadcms/payload

Errors on Admin during development from Next JS 16.3 with Cache Components Enabled

Open
#18,065 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

When running Next JS 16.3 with cache components enabled, we get an error "Next.js encountered the unstable value Date.now() while prerendering". Recommended solutions from Next JS: https://nextjs.org/docs/messages/blocking-prerender-current-time#generate-on-every-request

@birdzai Adding export const instant = false was not enough for me to get rid of the error.
I also needed to add await connection to the Page

import { connection } from 'next/server'

export const instant = false

const Page = async ({ params, searchParams }: Args) => {
  await connection()
  return RootPage({ config, params, searchParams, importMap })
}

Originally posted by @omaroskars in https://github.com/payloadcms/payload/issues/16020#issuecomment-5272483130

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not identify a source file, test, or specific admin page. Start by reproducing the error with Next.js 16.3 and cache components enabled, then trace the affected admin page and its prerendering configuration. Done means the development admin loads without the unstable Date.now() error and the behavior is covered by an appropriate test or reproduction check.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.