Introduction

Node.js often keeps serving old behavior after source or configuration changes. When runtime still reads the old file path after a directory move, one or more instances usually stayed warm on stale state, kept the previous file path in memory, or only partially reloaded defaults that are supposed to come from startup.

Symptoms

  • The expected change exists in source control but not in live behavior
  • One instance serves the new value while another still behaves the old way
  • A full restart helps, but partial reloads or hot swaps do not
  • The failure started after a config, path, domain, or middleware change

Common Causes

  • The application loads the affected setting only at startup
  • A warm worker retained the old path, flag, or artifact location
  • Partial reload logic skipped defaults that were injected at boot
  • A proxy or middleware layer rewrote the request path more than expected

Step-by-Step Fix

  1. 1.Inspect the live state first
  2. 2.Capture the active runtime path before changing anything so you know whether the process is stale, partially rolled, or reading the wrong dependency.
bash
date -u
printenv | sort | head -80
grep -R "error\|warn\|timeout\|retry\|version" logs . 2>/dev/null | tail -80
  1. 1.Compare the active configuration with the intended one
  2. 2.Look for drift between the live process and the deployment or configuration files it should be following.
bash
grep -R "timeout\|retry\|path\|secret\|buffer\|cache\|lease\|schedule" config deploy . 2>/dev/null | head -120
  1. 1.Apply one explicit fix path
  2. 2.Prefer one clear configuration change over several partial tweaks so every instance converges on the same behavior.
yaml
env:
  - name: APP_CONFIG_PATH
    value: /app/config/runtime.yaml
  - name: FEATURE_FLAG_SOURCE
    value: /app/config/flags.json
  - name: PUBLIC_BASE_URL
    value: https://example.com
  1. 1.Verify the full request or worker path end to end
  2. 2.Retest the same path that was failing rather than assuming a green deployment log means the runtime has recovered.
bash
curl -I https://example.com/health
curl -I https://example.com/version
curl -s https://example.com/config | head

Prevention

  • Publish active version, config, and runtime identity in one observable place
  • Verify the real traffic path after every rollout instead of relying on one green health log
  • Treat caches, workers, and background consumers as part of the same production system
  • Keep one source of truth for credentials, timeouts, routing, and cleanup rules