npx skills add https://github.com/different-ai/agent-bank --skill 'debug prod issues'重要提示:对于 0 Finance 项目,始终使用 --scope prologe:
# 所有 Vercel 命令都需要 --scope prologe
vercel logs www.0.finance --scope prologe
vercel ls --scope prologe
vercel env ls --scope prologe
# 流式传输实时日志(等待新日志)
vercel logs www.0.finance --scope prologe
# 自特定时间以来的日志
vercel logs www.0.finance --scope prologe --since 5m
vercel logs www.0.finance --scope prologe --since 1h
# 筛选日志(通过管道传递给 grep)
vercel logs www.0.finance --scope prologe 2>&1 | grep -i "error"
vercel logs www.0.finance --scope prologe 2>&1 | grep "ai-email"
注意:vercel logs 可能很慢/挂起。如果需要,请使用 或 Ctrl+C:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
timeouttimeout 30 vercel logs www.0.finance --scope prologe --since 5m 2>&1 | head -100
# 列出最近的部署
vercel ls --scope prologe | head -10
# 检查特定部署状态
vercel inspect <deployment-url> --scope prologe
# 获取最新部署 URL
vercel ls --scope prologe 2>/dev/null | head -1
切勿只是 sleep 并期望成功。请使用 vercel inspect --wait:
# 获取最新部署 URL
LATEST=$(vercel ls --scope prologe 2>/dev/null | head -1)
# 等待其准备就绪(最多 5 分钟)
vercel inspect "$LATEST" --scope prologe --wait --timeout 5m
# 检查输出中的状态:
# status: ● Building -> 仍在构建中
# status: ● Ready -> 已部署并上线!
# status: ● Error -> 构建失败
推送代码后的完整工作流程:
# 1. 推送您的更改
git push origin main
# 2. 等待几秒钟让 Vercel 获取
sleep 5
# 3. 获取新的部署 URL
LATEST=$(vercel ls --scope prologe 2>/dev/null | head -1)
echo "Waiting for: $LATEST"
# 4. 等待其完成
vercel inspect "$LATEST" --scope prologe --wait --timeout 5m
# 5. 现在您的更改已生效!
检查部署详情:
# 查看构建信息、别名和状态
vercel inspect <deployment-url> --scope prologe
# 如果失败,查看构建日志
vercel inspect <deployment-url> --scope prologe --logs
# 从当前状态重新部署生产环境
vercel --prod --scope prologe
# 或者推送到 git 并等待
git push origin main
# 然后使用上面的等待方法
# 列出环境变量
vercel env ls --scope prologe
# 添加环境变量(将提示输入值)
echo "value" | vercel env add VAR_NAME production --scope prologe
# 将环境变量拉取到本地 .env 文件
vercel env pull .env.local --scope prologe
关键:始终为生产数据库加载 .env.production.local:
import * as dotenv from 'dotenv';
import path from 'path';
// 加载生产环境变量
dotenv.config({
path: path.resolve(__dirname, '../.env.production.local'),
});
或在脚本中:
cd /path/to/zerofinance/packages/web
pnpm tsx -e "
import * as dotenv from 'dotenv';
dotenv.config({ path: '.env.production.local' });
// 现在使用数据库...
import { db } from './src/db';
"
Zero Finance 使用 Neon Postgres:
| 环境 | 主机模式 | 使用者 |
|---|---|---|
| 开发环境 | ep-aged-cherry-* | 本地开发,部分脚本 |
| 生产环境 | ep-wispy-recipe-* 或类似 | Vercel 部署,生产数据 |
始终验证您正在连接到哪个数据库:
[DB] Connecting to database host: ep-xxxxx-pooler.us-east-1.aws.neon.tech
| 表名 | 用途 |
|---|---|
user_safes | 与用户/工作空间关联的 Safe 地址 |
incoming_deposits | 入账 USDC 转账(从 Safe API 同步) |
outgoing_transfers | 从 Safes 发出的交易 |
users | 包含 primaryWorkspaceId 的用户记录 |
workspace_members | 用户-工作空间成员关系 |
earn_deposits | 金库存款记录 |
ai_email_sessions | AI 邮件代理会话记录 |
import * as dotenv from 'dotenv';
dotenv.config({ path: '.env.production.local' });
import { db } from './src/db';
import { userSafes, incomingDeposits } from './src/db/schema';
import { eq } from 'drizzle-orm';
async function main() {
// 您的调试代码放在这里
const safes = await db.select().from(userSafes);
console.log('Total safes:', safes.length);
}
main()
.then(() => process.exit(0))
.catch(console.error);
调试步骤:
curl -s -X POST "https://www.0.finance/api/endpoint" \
-H "Content-Type: application/json" \
-d '{"test": true}'
原因:
修复方法:
vercel ls --scope prologe | head -3vercel --prod --scope prologe调试:
const safe = await db.query.userSafes.findFirst({
where: eq(userSafes.safeAddress, '0x...'),
});
const user = await db.query.users.findFirst({
where: eq(users.privyDid, safe.userDid),
});
console.log('Safe workspace:', safe.workspaceId);
console.log('User primary workspace:', user.primaryWorkspaceId);
# 检查它是否在 Vercel 中设置
vercel env ls --scope prologe | grep VAR_NAME
# 检查它为哪些环境设置(生产、预览、开发)
# 可能需要重新部署才能使更改生效
此技能是测试金字塔的一部分。在以下情况使用:
| 场景 | 需要加载的技能 |
|---|---|
| 先在暂存环境测试 | test-staging-branch |
| 使代码可测试 | testability |
| 调试后,记录经验教训 | skill-reinforcement |
1. 首先检查 Vercel 日志(最快)
2. 如果不清楚,检查生产数据库
3. 如果仍然不清楚,在本地复现
4. 修复后,在推送到生产环境前在暂存环境测试
5. 使用新模式更新此技能
在此处追加新的发现
症状:使用 .env.production.local 时,POSTGRES_URL 缺失或主机错误。根本原因:packages/web/src/db/index.ts 在导入时加载 .env.local,这可能在 dotenv 配置之前运行。修复方法:在一次性脚本中,先调用 dotenv.config({ path: '.env.production.local' }),然后再动态导入 ./src/db。预防措施:避免在 CLI 脚本中静态导入 ./src/db;在 dotenv 设置后使用动态导入。
### YYYY-MM-DD: [问题描述]
**症状**: [您看到的现象]
**根本原因**: [发生原因]
**修复方法**: [如何解决]
**预防措施**: [未来如何避免]
每周安装次数
0
代码仓库
GitHub 星标数
202
首次出现时间
Jan 1, 1970
安全审计
IMPORTANT : Always use --scope prologe for the 0 Finance project:
# All Vercel commands need --scope prologe
vercel logs www.0.finance --scope prologe
vercel ls --scope prologe
vercel env ls --scope prologe
# Stream live logs (waits for new logs)
vercel logs www.0.finance --scope prologe
# Logs since a specific time
vercel logs www.0.finance --scope prologe --since 5m
vercel logs www.0.finance --scope prologe --since 1h
# Filter logs (pipe to grep)
vercel logs www.0.finance --scope prologe 2>&1 | grep -i "error"
vercel logs www.0.finance --scope prologe 2>&1 | grep "ai-email"
Note : vercel logs can be slow/hang. Use timeout or Ctrl+C if needed:
timeout 30 vercel logs www.0.finance --scope prologe --since 5m 2>&1 | head -100
# List recent deployments
vercel ls --scope prologe | head -10
# Check specific deployment status
vercel inspect <deployment-url> --scope prologe
# Get latest deployment URL
vercel ls --scope prologe 2>/dev/null | head -1
DO NOT just sleep and hope. Use vercel inspect --wait:
# Get the latest deployment URL
LATEST=$(vercel ls --scope prologe 2>/dev/null | head -1)
# Wait for it to be ready (up to 5 minutes)
vercel inspect "$LATEST" --scope prologe --wait --timeout 5m
# Check the status in the output:
# status: ● Building -> still building
# status: ● Ready -> deployed and live!
# status: ● Error -> build failed
Full workflow after pushing code:
# 1. Push your changes
git push origin main
# 2. Wait a few seconds for Vercel to pick it up
sleep 5
# 3. Get the new deployment URL
LATEST=$(vercel ls --scope prologe 2>/dev/null | head -1)
echo "Waiting for: $LATEST"
# 4. Wait for it to complete
vercel inspect "$LATEST" --scope prologe --wait --timeout 5m
# 5. Now your changes are live!
Check deployment details:
# See build info, aliases, and status
vercel inspect <deployment-url> --scope prologe
# See build logs if something failed
vercel inspect <deployment-url> --scope prologe --logs
# Redeploy production from current state
vercel --prod --scope prologe
# Or push to git and wait
git push origin main
# Then use the waiting method above
# List env vars
vercel env ls --scope prologe
# Add an env var (will prompt for value)
echo "value" | vercel env add VAR_NAME production --scope prologe
# Pull env vars to local .env
vercel env pull .env.local --scope prologe
CRITICAL : Always load .env.production.local for production database:
import * as dotenv from 'dotenv';
import path from 'path';
// Load production env
dotenv.config({
path: path.resolve(__dirname, '../.env.production.local'),
});
Or in a script:
cd /path/to/zerofinance/packages/web
pnpm tsx -e "
import * as dotenv from 'dotenv';
dotenv.config({ path: '.env.production.local' });
// Now use db...
import { db } from './src/db';
"
Zero Finance uses Neon Postgres :
| Environment | Host Pattern | Used By |
|---|---|---|
| Development | ep-aged-cherry-* | Local dev, some scripts |
| Production | ep-wispy-recipe-* or similar | Vercel deployment, prod data |
Always verify which database you're connecting to :
[DB] Connecting to database host: ep-xxxxx-pooler.us-east-1.aws.neon.tech
| Table | Purpose |
|---|---|
user_safes | Safe addresses linked to users/workspaces |
incoming_deposits | Incoming USDC transfers (synced from Safe API) |
outgoing_transfers | Outgoing transactions from Safes |
users | User records with primaryWorkspaceId |
workspace_members | User-workspace membership |
import * as dotenv from 'dotenv';
dotenv.config({ path: '.env.production.local' });
import { db } from './src/db';
import { userSafes, incomingDeposits } from './src/db/schema';
import { eq } from 'drizzle-orm';
async function main() {
// Your debugging code here
const safes = await db.select().from(userSafes);
console.log('Total safes:', safes.length);
}
main()
.then(() => process.exit(0))
.catch(console.error);
Debug steps :
Check Vercel logs for the specific endpoint
Look for stack traces or error messages
Test with curl to see response:
curl -s -X POST "https://www.0.finance/api/endpoint" \
-H "Content-Type: application/json" \
-d '{"test": true}'
Causes :
Fix :
vercel ls --scope prologe | head -3vercel --prod --scope prologeDebug :
const safe = await db.query.userSafes.findFirst({
where: eq(userSafes.safeAddress, '0x...'),
});
const user = await db.query.users.findFirst({
where: eq(users.privyDid, safe.userDid),
});
console.log('Safe workspace:', safe.workspaceId);
console.log('User primary workspace:', user.primaryWorkspaceId);
# Check it's set in Vercel
vercel env ls --scope prologe | grep VAR_NAME
# Check which environments it's set for (production, preview, development)
# May need to redeploy for changes to take effect
This skill is part of the testing pyramid. Use it when:
| Scenario | Skill to Load |
|---|---|
| Testing on staging first | test-staging-branch |
| Making code testable | testability |
| After debugging, capture learnings | skill-reinforcement |
1. Check Vercel logs first (fastest)
2. If unclear, inspect production DB
3. If still unclear, reproduce locally
4. After fix, test on staging before prod
5. Update this skill with new patterns
Append new discoveries here
Symptom : POSTGRES_URL missing or wrong host while using .env.production.local. Root Cause : packages/web/src/db/index.ts loads .env.local on import, which can run before dotenv config. Fix : In one-off scripts, call dotenv.config({ path: '.env.production.local' }) first and dynamically import ./src/db afterward. Prevention : Avoid static imports of ./src/db in CLI scripts; use dynamic import after dotenv setup.
### YYYY-MM-DD: [Issue Description]
**Symptom**: [What you saw]
**Root Cause**: [Why it happened]
**Fix**: [How to resolve]
**Prevention**: [How to avoid in future]
Weekly Installs
0
Repository
GitHub Stars
202
First Seen
Jan 1, 1970
Security Audits
earn_deposits| Vault deposit records |
ai_email_sessions | AI email agent conversation sessions |