From 6829c7efe2a735d249f5135bff4a0fc28411a295 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Mon, 3 Aug 2026 04:05:03 +0700 Subject: [PATCH] fix(infra): disable Next image disk cache for read-only Nix store Next.js image optimizer mkdirs /cache/images on first optimized-image request. In the Nix store that path is read-only, so every image request throws EACCES unhandledRejection. images.maximumDiskCacheSize=0 plus experimental.isrFlushToDisk=false keep the optimizer in-memory only. --- next.config.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/next.config.ts b/next.config.ts index 324b07a..50f8b6f 100644 --- a/next.config.ts +++ b/next.config.ts @@ -5,6 +5,16 @@ const nextConfig: NextConfig = { turbopack: { root: process.cwd(), }, + // Nix store is read-only at runtime; Next.js tries to mkdir + // /cache/images for the on-disk image optimizer LRU and + // crashes with EACCES unhandledRejection on every optimized image + // request. Disable the disk cache (and disable ISR flush which gates it). + images: { + maximumDiskCacheSize: 0, + }, + experimental: { + isrFlushToDisk: false, + }, }; export default nextConfig;