nango-server:hosted crash-loops: zod-to-json-schema hoisted to workspace root without its peer zod
Summary
The nangohq/nango-server:hosted image built 2026-08-07T08:36:41Z crash-loops on boot:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod'
imported from /app/nango/node_modules/zod-to-json-schema/dist/esm/parsers/array.js
Node.js v22.22.2The container never becomes healthy and restarts indefinitely (observed 62 restarts in ~90 minutes), so any compose stack that gates on its healthcheck fails to start.
Cause: a workspace hoisting mismatch, not a missing package
zod IS in the image - eight times, nested per package:
/app/nango/packages/server/node_modules/zod (4.0.5)
/app/nango/packages/utils/node_modules/zod
/app/nango/packages/tasks/node_modules/zod
/app/nango/packages/logs/node_modules/zod
/app/nango/packages/records/node_modules/zod
/app/nango/packages/metering/node_modules/zod
/app/nango/packages/usage/node_modules/zod
/app/nango/packages/lambda-runner/node_modules/zodBut zod-to-json-schema is hoisted to the workspace root, /app/nango/node_modules/, and
zod is not. Node resolving zod from the root copy walks up /app/nango/node_modules ->
/app/node_modules -> /node_modules; it never descends into packages/*/node_modules, so
none of the eight copies are reachable from it.
zod-to-json-schema declares zod as a peer with no regular dependency, so it is behaving
correctly - at the workspace root, nothing provides the peer:
"dependencies": {}
"peerDependencies": { "zod": "^3.25 || ^4" }Reproduce (no Nango configuration needed)
docker run --rm --entrypoint sh nangohq/nango-server:hosted -c '
ls -d /app/nango/node_modules/zod # No such file or directory
ls -d /app/nango/node_modules/zod-to-json-schema # present
cd /app/nango/node_modules/zod-to-json-schema && node -e "require.resolve(\"zod\")"
'
# -> MODULE_NOT_FOUNDConfirmed fix
Making a zod visible at the workspace root resolves it. Symlinking the already-present
copy is enough, and the server then boots and stays up:
ln -sfn /app/nango/packages/server/node_modules/zod /app/nango/node_modules/zodThe nested version (4.0.5) satisfies the declared peer range, so this is not a version override - only a visibility fix.
The proper fix is presumably in the workspace hoisting configuration (hoisting zod
alongside its dependent, or not hoisting zod-to-json-schema to the root). Which of those is
right depends on your build tooling, so I have not sent a PR - happy to if you say which
direction you would prefer.
Environment
- Image:
nangohq/nango-server:hosted, built2026-08-07T08:36:41Z - Node v22.22.2, entrypoint
packages/server/entrypoint.sh - Self-hosted via docker compose
Source: NangoHQ/nango