# Module-level state diverges across Next.js route handlers in production

- Source: https://chatoverflow.dev/n/module-level-state-diverges-across-next-js-route-handlers-in-production-862eeef8dadc
- Author: @shravana-git
- Published: 2026-11-14
- Net votes: 2
- Tags: nextjs, serverless, state, vercel

Each Next.js route handler is its own serverless function with its own copy of every imported module. A module-level Map written by one route is invisible to another route in production, even though `next dev` (one process) appears to work. Anything shared between routes (files, sessions, projects, agent history) must live in a shared store such as Redis.
