Skip to content

In Next 15.2.1 revalidate property was removed from ctx and data.revalidate should be used instead #1027

@AyronK

Description

@AyronK

Brief Description of the Bug
A clear and concise description of what the bug is.

In Next 15.2.1 revalidate property was removed from ctx and data.revalidate should be used instead. This leads to all entries having default staleAge of exactly one year.

vercel/next.js@6a1b633

Severity
[Critical]

Frequency of Occurrence
[Always]

Steps to Reproduce
Provide detailed steps to reproduce the behavior, including any specific conditions or configurations where the bug occurs:

  1. Use for example redis-string cache handler on Next 15.2.1 and compare the TTL with Next 15.2.0 or lower. It gets an extra year.

Expected vs. Actual Behavior
ctx.data.revalidate should be used to calculate TTL instead of ctx.revalidate

Screenshots/Logs
If applicable, add screenshots or error logs to help explain your problem.

Next 15.2.0

{
	"lastModified": 1743067428332,
	"lifespan": {
		"expireAge": 283, // correct 
		"expireAt": 1743067711, // correct 
		"lastModifiedAt": 1743067428, // correct 
		"revalidate": 189, // correct 
		"staleAge": 189, // correct 
		"staleAt": 1743067617 // correct 
	},
	"tags": [
		"ga::search-{\"query\":\"*\",\"subset\":\"category:='Kampagner#Fast lav pris'\",\"filterBy\":\"\",\"sortBy\":\"\",\"page\":null,\"pageSize\":24}"
	],
	"value": {
		"kind": "FETCH",
		"data": {
			"headers": {
				"content-type": "application/json; charset=utf-8",
				"date": "Thu, 27 Mar 2025 09:23:48 GMT",
				"request-context": "appId=cid-v1:9c14f46e-c7d4-41eb-b46b-ba886096fb7d",
				"server": "Kestrel",
				"transfer-encoding": "chunked"
			}
		}
	}
}

Next 15.2.1

{
	"lastModified": 1743068361456,
	"lifespan": {
		"expireAge": 47304000, // extra year
		"expireAt": 1790372361, // extra year
		"lastModifiedAt": 1743068361,
		"staleAge": 31536000, // extra year
		"staleAt": 1774604361 // extra year
	},
	"tags": [
		"ga::search-{\"query\":\"*\",\"subset\":\"category:='Kampagner#Fast lav pris'\",\"filterBy\":\"\",\"sortBy\":\"\",\"page\":null,\"pageSize\":24}"
	],
	"value": {
		"kind": "FETCH",
		"data": {
			"headers": {
				"content-type": "application/json; charset=utf-8",
				"date": "Thu, 27 Mar 2025 09:39:20 GMT",
				"request-context": "appId=cid-v1:9c14f46e-c7d4-41eb-b46b-ba886096fb7d",
				"server": "Kestrel",
				"transfer-encoding": "chunked"
			}
		}
	}
}

Environment:

  • OS: n/a
  • Node.js version: [22.14.0]
  • @neshca/cache-handler version: [1.9.0]
  • next version: 15.2.1

Dependencies and Versions
List any relevant dependencies and their versions.

Attempted Solutions or Workarounds

 const { revalidate, tags = [], neshca_lastModified, value } = ctx;

        const lastModified = Math.round(neshca_lastModified ?? Date.now());

        const hasFallbackFalse = CacheHandler.#fallbackFalseRoutes.has(cacheKey);

        const lifespan = hasFallbackFalse ? null : CacheHandler.#getLifespanParameters(lastModified, revalidate || value?.revalidate);

Impact of the Bug
Critical, we can't upgrade Next version which has a vulnerability due to this issue.

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions