cloudflare / cloudflare/vinext

[nextjs-tracker] Align cache-scope diagnostics with Next.js

Open
#3,134 0 comments 0 reactions 0 assignees View on GitHub
nextjs-tracking
Dominant language
TypeScript
Stars
8.8k
Forks
406
Avg merge
2d 6h
Merged PRs (30d)
120

Description

## Next.js change

Next.js centralized and rewrote the user-facing errors for `"use cache"`, `"use cache: private"`, and `unstable_cache()`. The diagnostics now consistently include the active route, state the prohibited operation and immediate remediation, and end with a relevant `Learn more:` link. This also makes the `revalidateTag()` errors consistent across rendering, cache scopes, and `generateStaticParams`.

**Commit:** [`e9180ea`](https://github.com/vercel/next.js/commit/e9180eae2afd6794018e206cca2c14adc7fbe1d1)
**PR:** [#94300](https://github.com/vercel/next.js/pull/94300)
**Next.js files changed:** `packages/next/src/server/use-cache/`, `packages/next/src/server/web/spec-extension/`, `packages/next/src/server/app-render/`, and related App Router error tests.

## Why this matters to vinext

vinext implements cache directives, `unstable_cache()`, request APIs, and revalidation. Their validation errors are user-visible compatibility behavior: applications and tooling rely on actionable build/SSR diagnostics, and the redbox should match Next.js when an App Router route is available.

The updated cases include request data (`searchParams`, `headers()`, `cookies()`, `request.url`) inside caches, `connection()` in public or private caches, draft-mode mutation, `cacheTag()` / `cacheLife()` outside cache scopes, invalid private-cache composition, cache-fill timeouts/deadlocks, and `revalidateTag()` during render, cache filling, or `generateStaticParams`.

## Priority

**Low**

## Suggested action

- Audit vinext cache-scope and revalidation error paths against the upstream message templates.
- Include `Route "":` when an App Router route is known, identify the invalid API and correction, and append the matching Next.js documentation URL.
- Consolidate shared message construction where practical so the same error is emitted consistently in dev and production.
- Add focused regression tests for representative request-data, private-cache, and revalidation errors, including route-prefixed output.

Contributor guide

Open the contributing guide

Research direction

Start by comparing vinext’s cache-scope and revalidation error paths with the upstream commit e9180ea and PR #94300. Read Next.js files under packages/next/src/server/use-cache/, packages/next/src/server/web/spec-extension/, packages/next/src/server/app-render/, and the related App Router error tests. Done means representative request-data, private-cache, and revalidation diagnostics consistently include the route when known, remediation, and the matching Learn more link in development and production.

Written by the indexing model from the issue text.

Assessment

Tech stack
nextjs, typescript
Domain
backend-api-design, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.