协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
sync-debug【开发与工程】Diagnose a failing or misbehaving sync — fetch run logs, identify errors, cross-reference with code, and suggest fixes
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Help the user figure out why their sync is failing or producing wrong results. Work through the steps below systematically.
Run these commands to understand the situation:
ntn workers sync status
Note which syncs are listed, their status, last run time, and next scheduled run. Look for syncs that are stuck, failing, or haven't run recently.
ntn workers runs list
Look for runs with non-zero exit codes (shown in red in table output). Note the run IDs for failed runs.
For the most recent run (any capability):
ntn workers runs list --plain | head -n1 | cut -f1 | xargs -I{} ntn workers runs logs {}
For the most recent run of a specific sync:
ntn workers runs list --plain | grep <syncKey> | head -n1 | cut -f1 | xargs -I{} ntn workers runs logs {}
Read the full log output. Look for error messages, stack traces, and any console.log output from the sync code.
Read src/index.ts (and any imported modules) to understand the sync's logic. Cross-reference the error from the logs with the code.
Common failure patterns and their fixes:
API Authentication Errors (401/403)
ntn workers oauth token <oauthKey>ntn workers env listntn workers env pushntn workers oauth start <key> to re-authenticateRate Limiting (429)
Timeout / Long Execution
Cursor / State Errors
ntn workers sync state reset <key> to clear state and re-backfill from scratchSchema Mismatch
changes don't match the schema.properties definitionproperties object of each change matches a key in the schemaBuilder.title() is used for Schema.title() properties, Builder.richText() for Schema.richText(), etc.Infinite Loop (sync never completes)
hasMore is always true — the cursor isn't advancingnextState changes between iterationsEmpty Results
Network / Transient Errors
ntn workers sync trigger <key>After identifying the issue:
npm run check to verify typesntn workers sync state reset <key> (this triggers a full re-backfill)/sync-preview or run ntn workers deploy && ntn workers sync trigger <key> --previewntn workers sync trigger <key> to resume