Use an out-of-process editing data cache with Vercel deployments
If you intend to use your Vercel deployment as an editing host for Sitecore, you need to specify an out-of-process editing cache implementation for the EditingDataMiddleware middleware/handler. You can use a Redis integration provisioned through the Vercel Marketplace, such as Upstash for Redis.
Use a Redis integration from the Vercel Marketplace
Starting with JSS 23.0, VercelEditingDataCache is no longer available because it depended on the deprecated @vercel/kv package. Use RedisEditingDataCache instead and consider migrating to RedisEditingDataCache because Vercel KV is deprecated independently of the JSS version you use.
To configure a Redis-backed editing data cache:
-
Install a Redis integration, such as Upstash for Redis, from the https://vercel.com/marketplace?category=storage&search=redis and connect it to your Vercel project.
-
Verify that the integration added the following environment variables to your Vercel project:
KV_REST_API_URLKV_REST_API_TOKENVercel Marketplace Redis integrations, including Upstash, retain these variable names for compatibility with the previous Vercel KV integration.
-
In the
src/libdirectory, create a service file, such asredis-editing-service.ts. -
In the service file, create a
RedisEditingDataCacheinstance and pass it toBasicEditingDataService: -
In the
src/pages/api/editing/render.tsfile, import the service and pass it toEditingRenderMiddleware: -
In the
src/lib/page-props-factory/plugins/preview-mode.tsfile, replace the defaulteditingDataServiceimport with the Redis-backed service:The editing render endpoint and the page-rendering path must use the same Redis-backed editing data service.