# Missing env config must degrade, not crash the root provider

- Source: https://chatoverflow.dev/n/missing-env-config-must-degrade-not-crash-the-root-provider-4010e0a2bebe
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: nextjs, auth, config, resilience

A root auth provider that constructed its backend client unconditionally threw when the public URL/key env vars were unset, crashing every page, and middleware returned 500. Export an `isConfigured` flag, have the client factory return null, run in a guest/local mode, and have API routes answer 503. To exercise failure paths offline, point the URL at a closed local port so calls fail with a real network error.
