投递行为
取自该平台的官方文档,最近核对于 2026-08-06。平台没有给出数字的地方,这张表也不填。
| 响应时限 | 平台未公布 |
|---|---|
| 重试 | 平台未公布 |
| 放弃 | 平台未公布 |
签名
用一个经测试套件证明的可运行验证器核对,不是照着文档读来的。最近核对于 2026-08-20。
| 算法 | HMAC-SHA1 |
|---|---|
| 待签名串 | raw body |
| 编码 | hex |
| 请求头 | x-vercel-signature |
| 时间容差 | 无强制要求 |
验证签名
要用原始请求体,逐字节一致,并且在任何 JSON 解析之前。框架一旦重新序列化请求体,本页的每一种方案都会失效。
const crypto = require("node:crypto");
// hex(HMAC-SHA1(webhook secret, raw body))
const expected = crypto
.createHmac("sha1", webhookSecret) // Team Settings → Webhooks, shown once
.update(rawBody)
.digest("hex");
const received = Buffer.from(req.headers["x-vercel-signature"] ?? "");
const wanted = Buffer.from(expected);
// timingSafeEqual throws on a length mismatch, so check that first.
const valid =
received.length === wanted.length && crypto.timingSafeEqual(received, wanted);容易踩的坑
密钥只在创建时显示一次。弄丢了,唯一的办法是删除并重新创建 Webhook:没有可以回头再查看的按钮。
延伸阅读
AnyHook 挡在接收 Vercel Webhook 的端点前面:约 1 秒应答,你的服务器宕机时按自己的计划重试,并且每个事件都可以重放。 只改一个 URL,代码不用动。