The sync command spawns the engine HTTP server as a child process (apps/engine/src/cli/subprocess.ts). This has several implications for debugging.
The sync command pipes the subprocess's stdout and stderr to a log file in the repo root:
- File:
sync-${schema}.logwhereschemais the--postgres-schemaarg (default:public) - So usually:
sync-public.log
console.error() in connector code (source-stripe, etc.) goes to that file, not the terminal. Check it after a run:
grep "your_debug_marker" sync-public.logThe subprocess uses --conditions bun --import tsx. The "bun" export condition in each workspace package's package.json points to ./src/index.ts, and pnpm symlinks workspace packages (not copies). This means:
- Edits to
.tssource files in any workspace package are picked up immediately by the subprocess - No
pnpm buildorpnpm installneeded between edits - Just edit, save, re-run the script
This relies on injectWorkspacePackages NOT being set in pnpm-workspace.yaml. If that setting is ever re-enabled, pnpm will copy files into the store (breaking live propagation) and you'd need pnpm install after every edit.
| Consumer | Resolves via | Points to |
|---|---|---|
| Subprocess (sync CLI) | "bun" condition |
./src/index.ts (live source, transpiled by tsx) |
| Vitest | "import" condition |
./dist/index.js (compiled output) |
- The sync CLI does not need dist/ at all
- Vitest does need dist/ — if tests fail with "Cannot find module", rebuild the relevant package
apps/supabasebuild is Deno-only and frequently fails — you may need to stubapps/supabase/dist/index.jsfor the engine CLI to start (it has a static import)
- Add
console.error('[MARKER] ...')to the code you want to trace - Run the sync command you want to debug
- Inspect
sync-public.log(orsync-{schema}.log) in the repo root - Clean up debug code when done