Next.js
11 articles on Next.js, each a problem from production engineering work and how it was solved.
-
Don't cache failures in Next.js 16 "use cache": throw, catch outside
A fallback returned from a "use cache" function is cached like real data. Let the cached function throw and catch the error in an uncached wrapper.
-
Why a required Drupal media field is null in a Next.js front end
Required is a form rule, not a read guarantee: unpublished or deleted media resolves to null, so type references as nullable and render each item defensively.
-
Why a Drupal Views upcoming events list keeps showing past events
Tag caching never expires a date-filtered View, because nothing is saved when time passes. Filter on end date and give the list a time-based cache.
-
Parallel Cypress runs in Bitbucket Pipelines without Cypress Cloud
Without a record key, give each Bitbucket parallel step every Nth spec using BITBUCKET_PARALLEL_STEP, and skip the run when its share is empty.
-
GraphQL Compose drops text field cache tags: how to keep them
Add each text item's processed property as a cacheable dependency in hook_graphql_compose_field_results_alter, and version image URLs by file changed time.
-
Purge Fastly after Next.js 16 revalidation, not before
Purge the CDN inside after(), once revalidatePath has run, and purge again a few seconds later so a stale page served mid-rebuild is not kept.
-
Capping the Next.js 16 image cache with maximumDiskCacheSize
Set images.maximumDiskCacheSize in Next.js 16 and the optimiser evicts least-recently-used images itself, so you can delete a cron or start-up prune.
-
A Next.js 16 Redis cacheHandler that fails fast when Redis is down
Connect lazily, key by build ID and set short ioredis timeouts so a Redis outage becomes a cache miss in a Next.js 16 cacheHandler.
-
Keep Next.js .next/cache when restoring a build on a persistent volume
If a start script wipes .next to restore a build, exclude the cache folder or every deploy throws away the fetch and image caches.
-
Next.js 16 image optimizer blocks local IPs: how to allow them safely
Enable dangerouslyAllowLocalIP only when the image host is itself local, not on CI or NODE_ENV checks, so deployed hosts keep the private-IP guard.
-
Making Next.js 16 tag revalidation work across several instances
Why revalidateTag only reaches one process by default in Next.js 16, and how a shared Redis tag store fixes it for both cache layers.