vercel-logs
Query and stream Vercel runtime/build logs for the production deployment via the CLI. Use when diagnosing errors, investigating 500s/401s, confirming a fix deployed cleanly, or watching a deploy land. Read-only — never deploys, rolls back, or mutates project state.
- License 许可
- MIT
- 所属仓库
- dotlas/skills
- 最近更新
- 2026-10-27
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- vercel-logs
- description
- Query and stream Vercel runtime/build logs for the production deployment via the CLI. Use when diagnosing errors, investigating 500s/401s, confirming a fix deployed cleanly, or watching a deploy land. Read-only — never deploys, rolls back, or mutates project state.
03 SKILL.md 正文
Vercel Logs
Safety
- Read-only. NEVER run
vercel deploy,vercel rollback,vercel alias,vercel env add/rm,vercel project rm, or any mutation. This skill only reads logs. - NEVER print secrets from log output. If a log line contains env var values, API keys, or tokens, redact before presenting.
- Use
--no-branchalways. The CLI auto-detects the local git branch and silently filters to it — wrong for production debugging. Always pass--no-branchor--environment productionexplicitly. - Detach stdin. Append
< /dev/nullto everyvercelcommand. Without it the CLI sniffs the TTY and hangs in agent shells. - Bound output. Always pass
--limit N(default 20, max 100). For--followruns, cap the observation window and kill the terminal when done — do not follow indefinitely.
Prerequisites
cd <repo-root>/<app>
pnpm exec vercel whoami < /dev/null 2>&1
cat .vercel/project.json 2>/dev/null | grep -o '"projectId":"[^"]*"'
If whoami fails → stop, tell user to run pnpm exec vercel login. If
.vercel/project.json is missing → run:
cd <app> && pnpm exec vercel link --yes --scope <your-scope> --project <your-vercel-project>
Retention: Hobby = 1h · Pro = 24h · Pro + Observability Plus = 30 days · Enterprise = 3 days. If the user asks for logs beyond the retention window, tell them and suggest checking external log drains if configured.
Query modes
Recent errors (default diagnostic)
The go-to when the user reports “something broke in prod”:
cd <repo-root>/<app> && \
pnpm exec vercel logs \
--no-branch \
--environment production \
--level error \
--since 1h \
--limit 20 \
--json \
--expand \
--no-follow \
< /dev/null 2>&1 | grep -E '^[{]' | jq .
Important: The CLI emits non-JSON preamble lines.
Always filter with grep -E '^[{]' before piping to jq. Use [{] not ^\{ — zsh
interprets bare braces.
Each line:
{
"id": "...",
"timestamp": 1779108733174,
"level": "error",
"message": "...",
"source": "serverless|edge-middleware|edge-function",
"requestMethod": "GET|POST",
"requestPath": "/api/...",
"responseStatusCode": 500,
"environment": "production",
"logs": [{ "level": "error", "message": "..." }] // with --expand
}
Filtered by route/status
pnpm exec vercel logs \
--no-branch --environment production \
--status-code 500 \
--query "/api/your-route" \
--since 6h --limit 30 --json --expand --no-follow \
< /dev/null 2>&1 | cat
Filtered by search query
pnpm exec vercel logs \
--no-branch --environment production \
--query "DISPATCH_FAILED" \
--since 24h --limit 20 --json --expand --no-follow \
< /dev/null 2>&1 | cat
Trace a single request
pnpm exec vercel logs \
--request-id req_xxxxx \
--json --expand --no-follow \
< /dev/null 2>&1 | cat
Live streaming
Use async terminal mode. Kill when observation is done.
pnpm exec vercel logs \
--no-branch --environment production \
--follow \
--level error \
--json \
< /dev/null 2>&1
Check output periodically with get_terminal_output. Kill when done observing.
Build logs
# Get the latest production deployment ID
DEPLOY_ID=$(pnpm exec vercel ls <your-vercel-project> --scope <your-scope> --prod < /dev/null 2>&1 \
| awk '/dpl_/ {print $2; exit}')
pnpm exec vercel inspect "$DEPLOY_ID" --logs < /dev/null 2>&1 | tail -50
Correlate to code
After pulling logs:
-
Map
requestPath→ route file using your project’s directory structure:/api/trpc/<router>.<procedure>→<trpc-routers>/<router>.ts(for tRPC projects)/api/cron/<name>→<app>/app/api/cron/<name>/route.ts- Other
/api/*routes →<app>/app/api/<name>/route.ts
Check your project’s route conventions to establish this mapping before starting.
-
Extract the inner error from
message:[tRPC] <router>.<procedure> failed: <error>→ search<trpc-routers>/for the procedure[DISPATCH_FAILED] HTTP 401 — <!doctype html>→ Deployment Protection gate (check Vercel conventions doc)[DISPATCH_FAILED] HTTP 401 — {"error":"Unauthorized"}→ Bearer auth mismatch[DISPATCH_FAILED] fetch failed→ URL resolution failure (checkNEXT_PUBLIC_APP_URL)
-
Search the codebase for the error string to find the throw site.
-
Report with: error count and time range · grouped by route/error type · source file + line for each unique error · suggested fix or next diagnostic step.
Common recipes
“Is prod healthy right now?”
cd <repo-root>/<app> && \
pnpm exec vercel logs \
--no-branch --environment production \
--level error --since 30m --limit 50 \
--json --no-follow \
< /dev/null 2>&1 | grep -E '^[{]' | jq -s '
group_by(.requestPath) |
map({route: .[0].requestPath, count: length, last: (max_by(.timestamp) | .timestamp | . / 1000 | todate)}) |
sort_by(-.count)
'
“Did my fix deploy cleanly?”
cd <repo-root>/<app> && \
pnpm exec vercel logs \
--no-branch --environment production \
--query "<error-string-that-should-be-gone>" \
--since 10m --limit 5 \
--json --no-follow \
< /dev/null 2>&1 | grep -E '^[{]' | jq .
Zero results = fix is live. Results still appearing = not deployed yet or fix didn’t work.
“What’s the current deployment?”
cd <repo-root>/<app> && \
pnpm exec vercel ls <your-vercel-project> --scope <your-scope> --prod < /dev/null 2>&1 | head -5
04 同仓库更多 Skills
where-were-we
Provide the user with a refresher of existing chat turns. Useful when the user wants to understand where we stand in the conversation.
update-global-dotlas-skills
Sync the globally-installed dotlas/skills catalog and prune stale remnants. Runs the documented global install command, then detects skills that were installed from dotlas/skills but no longer exist in the catalog and removes them (with confirmation). Use when the user wants to update, refresh, or clean up their global Dotlas skills, or invokes /update-global-dotlas-skills.
unpack
Explain an unfamiliar thing plainly and from first principles, structured so the reader sees why it is true. Use when someone is trying to understand something — a dense or jargon-heavy passage, a baffling error, an unfamiliar mechanism, a codebase, or a document — asks to break something down ("walk me through this", "what does this actually mean"), or wants their intent turned into a precise instruction for another agent. Trigger on confusion or a request to understand, not on difficulty alone; technical or long content is not itself a signal.
sum
Use when the previous response is too technical, complex, or jargon-heavy and needs a clear, plain-language explanation
slack
Compose a Slack message, or digest a Slack thread into compact context. Use when the user asks to reply to a person or channel, write a Slack post, or catch up on a thread without reading the whole transcript. This skill covers how to write well for Slack — both jobs share the same standard.
plan-with-me
Collaborative, human-in-the-loop planning for something new that spans several parts and needs human judgement at each fork. A brainstorming partner that funnels — each fork opens up the real options, then narrows to a decision, surfacing caveats and breaking points, and co-authoring the plan instead of guessing alone. Fits any domain where you plan something new against existing context. Resolves one decision at a time, each with a recommendation, then emits a lightweight plan to hand off for implementation. Use when planning alone would make wrong assumptions, or the user wants to shape something new together.