convex-logs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCheck Convex logs
查看Convex日志
Use this skill when you need to inspect what is happening in a Convex deployment: failed actions, validation errors, 401 unauthorized from external APIs, or which functions ran and how long they took.
当你需要检查Convex部署中的情况时可以使用该技能:比如动作执行失败、验证错误、外部API返回401未授权,或者查看哪些函数已运行及其耗时。
When to use this skill
适用场景
- User reports an error from Convex (e.g. "unauthorized", "ArgumentValidationError", action timeout).
- You need to confirm which Convex deployment (dev vs prod) is being used.
- You need to see recent function executions (queries, mutations, actions) and their success/failure.
- You are debugging Convex env vars (e.g. OA_INTERNAL_KEY, PUBLIC_API_URL) and want to correlate with API responses in logs.
- 用户反馈Convex相关错误(例如“unauthorized”、“ArgumentValidationError”、动作超时)。
- 你需要确认正在使用的是哪个Convex部署(开发环境vs生产环境)。
- 你需要查看最近的函数执行记录(查询、变更、动作)及其成功/失败状态。
- 你正在调试Convex环境变量(例如OA_INTERNAL_KEY、PUBLIC_API_URL),并希望与日志中的API响应关联分析。
Prerequisites
前置条件
- The project must use Convex and have (or
npx convexCLI) available.convex - Run Convex commands from the app directory that contains the folder (e.g.
convex/in a monorepo).apps/web - You must be logged in and have the correct Convex project linked (to verify).
npx convex dashboard
- 项目必须使用Convex,且可使用(或
npx convexCLI)。convex - 从包含文件夹的应用目录中运行Convex命令(例如 monorepo 中的
convex/)。apps/web - 你必须已登录并关联了正确的Convex项目(可通过验证)。
npx convex dashboard
Default deployment: dev vs prod
默认部署:开发环境vs生产环境
Important: By default, and target the dev deployment. For production issues (e.g. openagents.com), you must pass .
convex logsconvex env--prod- Dev (default): streams from the project's dev deployment.
npx convex logs - Prod: streams from the project's production deployment.
npx convex logs --prod
Same for env vars: shows dev; shows production.
npx convex env listnpx convex env list --prod重要提示: 默认情况下,和指向开发部署。针对生产环境问题(例如openagents.com),必须添加参数。
convex logsconvex env--prod- 开发环境(默认): 流式传输项目开发部署的日志。
npx convex logs - 生产环境: 流式传输项目生产部署的日志。
npx convex logs --prod
环境变量命令同理: 显示开发环境变量; 显示生产环境变量。
npx convex env listnpx convex env list --prodCommands
命令
Stream or fetch logs
流式传输或获取日志
bash
undefinedbash
undefinedFrom the app that has convex/ (e.g. apps/web)
进入包含convex/的应用目录(例如apps/web)
cd apps/web
cd apps/web
Stream logs (default: dev). Use Ctrl+C to stop.
流式传输日志(默认:开发环境)。按Ctrl+C停止。
npx convex logs
npx convex logs
Stream production logs
流式传输生产环境日志
npx convex logs --prod
npx convex logs --prod
Show last N log entries then exit (no streaming). Good for quick checks.
显示最后N条日志条目后退出(非流式传输)。适合快速检查。
npx convex logs --prod --history 30
npx convex logs --prod --history 30
Include successful executions (default is failures only in some contexts)
包含成功的执行记录(某些场景下默认仅显示失败记录)
npx convex logs --prod --history 25 --success
undefinednpx convex logs --prod --history 25 --success
undefinedLog command options
日志命令选项
| Option | Meaning |
|---|---|
| Use the production deployment (required for prod debugging). |
| Show the last |
| Include successful function runs in the output. |
| Output raw log events as JSONL. |
| Target a specific deployment (e.g. |
| Use env file for CONVEX_DEPLOYMENT or similar. |
| 选项 | 说明 |
|---|---|
| 使用生产部署(调试生产环境问题时必填)。 |
| 显示最后 |
| 在输出中包含成功的函数运行记录。 |
| 以JSONL格式输出原始日志事件。 |
| 针对特定部署(例如 |
| 使用指定的环境文件来设置CONVEX_DEPLOYMENT等变量。 |
Inspect environment variables
检查环境变量
Convex actions do not read . They only see variables set in the Convex deployment (Dashboard or CLI). To see what the deployment has:
.env.localbash
undefinedConvex动作不会读取文件。它们仅能访问Convex部署中设置的变量(通过控制台或CLI)。要查看部署中的变量:
.env.localbash
undefinedList env vars on dev (default)
列出开发环境的变量(默认)
npx convex env list
npx convex env list
List env vars on production
列出生产环境的变量
npx convex env list --prod
npx convex env list --prod
Get a single variable (e.g. confirm OA_INTERNAL_KEY is set; value is hidden in output)
获取单个变量(例如确认OA_INTERNAL_KEY已设置;输出中会隐藏值)
npx convex env get OA_INTERNAL_KEY --prod
Use this to confirm that keys and URLs (e.g. `OA_INTERNAL_KEY`, `PUBLIC_API_URL`) are set on the deployment that's actually serving the app.npx convex env get OA_INTERNAL_KEY --prod
使用该命令可以确认密钥和URL(例如`OA_INTERNAL_KEY`、`PUBLIC_API_URL`)是否在实际提供服务的部署中已正确设置。Typical workflow
典型工作流
- Reproduce the issue (e.g. open Hatchery, trigger an action that returns 401).
- Fetch recent prod logs (if the app is production):
bash
cd apps/web npx convex logs --prod --history 30 --success - Find the failing function in the output (e.g. ).
[CONVEX A(openclawApi:getRuntimeStatus)] [ERROR] ... 401 'unauthorized' - Confirm which deployment is used: logs show the deployment name (e.g. for prod).
successful-mongoose-647 - Check env vars for that deployment: (or without
npx convex env list --prodfor dev).--prod - Fix env in Convex (Dashboard or ) or fix the calling code; redeploy if needed.
npx convex env set ...
- 复现问题(例如打开Hatchery,触发返回401的动作)。
- 获取最近的生产环境日志(如果应用是生产环境):
bash
cd apps/web npx convex logs --prod --history 30 --success - 在输出中找到失败的函数(例如)。
[CONVEX A(openclawApi:getRuntimeStatus)] [ERROR] ... 401 'unauthorized' - 确认使用的部署:日志中会显示部署名称(例如生产环境的)。
successful-mongoose-647 - 检查该部署的环境变量:(开发环境则去掉
npx convex env list --prod)。--prod - 修复问题:在Convex中设置正确的环境变量(通过控制台或),或者修复调用代码;必要时重新部署。
npx convex env set ...
Example log output
日志输出示例
Watching logs for production deployment successful-mongoose-647...
2/4/2026, 12:39:06 PM [CONVEX A(openclawApi:getInstance)] Function executed in 434 ms
2/4/2026, 12:39:06 PM [CONVEX A(openclawApi:getRuntimeStatus)] [ERROR] '[openclawApi getRuntimeStatus] API error response:' 401 'unauthorized'
2/4/2026, 12:39:06 PM [CONVEX A(openclawApi:getRuntimeStatus)] Uncaught Error: unauthorized ...Here, succeeded but got 401 from the external API—often a mismatch of between Convex and the API worker.
getInstancegetRuntimeStatusOA_INTERNAL_KEYWatching logs for production deployment successful-mongoose-647...
2/4/2026, 12:39:06 PM [CONVEX A(openclawApi:getInstance)] Function executed in 434 ms
2/4/2026, 12:39:06 PM [CONVEX A(openclawApi:getRuntimeStatus)] [ERROR] '[openclawApi getRuntimeStatus] API error response:' 401 'unauthorized'
2/4/2026, 12:39:06 PM [CONVEX A(openclawApi:getRuntimeStatus)] Uncaught Error: unauthorized ...在此示例中,执行成功,但从外部API收到401未授权错误——通常是由于Convex和API服务端的不匹配导致的。
getInstancegetRuntimeStatusOA_INTERNAL_KEYTroubleshooting
故障排除
- "No logs" or wrong deployment: Use when the live app uses the production Convex deployment.
--prod - 401 from Convex actions calling an API: Set (and
OA_INTERNAL_KEYif needed) in the same Convex deployment that runs the action (PUBLIC_API_URL), and ensure the API worker has the same key (e.g.npx convex env set OA_INTERNAL_KEY "..." --prodin the API app).npx wrangler secret put OA_INTERNAL_KEY - Timeout when streaming: Use to fetch a finite number of entries and exit instead of streaming.
--history N - Need a specific deployment: Use (e.g.
--deployment-name <name>) for that deployment's logs.dev:effervescent-anteater-82
- “无日志”或部署错误: 当线上应用使用Convex生产部署时,需添加参数。
--prod - Convex动作调用API时返回401: 在运行该动作的Convex部署中设置(必要时同时设置
OA_INTERNAL_KEY)(PUBLIC_API_URL),并确保API服务端使用相同的密钥(例如在API应用中执行npx convex env set OA_INTERNAL_KEY "..." --prod)。npx wrangler secret put OA_INTERNAL_KEY - 流式传输时超时: 使用参数获取指定数量的日志条目后退出,而非持续流式传输。
--history N - 需要针对特定部署: 使用参数(例如
--deployment-name <name>)查看该部署的日志。dev:effervescent-anteater-82