Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

vercel-log-drains-webhooks

БесплатноЗапускает вложенные скриптыНе проверен

Receive and verify Vercel Log Drains deliveries. Use when setting up a Vercel log drain HTTP endpoint, debugging x-vercel-signature verification, passing the…

hookdeckот hookdeck★ 104 звезды на GitHub

Об этом скилле

Vercel Log Drains Webhooks

Vercel Log Drains forward deployment logs to any HTTPS endpoint you configure. These are HTTP log-drain deliveries (not "Vercel webhooks" and not Standard Webhooks): Vercel POSTs batches of log entries and signs the raw body with HMAC-SHA1.

When to Use This Skill

  • How do I receive Vercel Log Drains?
  • How do I verify the x-vercel-signature header?
  • How do I pass the endpoint test when I create a drain?
  • Why is my Vercel log drain signature verification failing?
  • How do I parse batched log entries (JSON array or NDJSON)?
  • How do I handle logs from lambda, edge, build, or firewall sources?

Verification (core)

Vercel signs the raw request body with HMAC-SHA1 keyed on your drain's signature secret and sends the hex digest in the x-vercel-signature header (the raw digest — no sha1= prefix). Use the raw body (do not re-serialize), and compare timing-safe.

Node:

const crypto = require('crypto');

function verify(rawBody, signatureHeader, secret) {
  if (!signatureHeader) return false;
  const expected = crypto.createHmac('sha1', secret).update(rawBody).digest('hex');
  try {
    return crypto.timingSafeEqual(
      Buffer.from(signatureHeader, 'hex'),
      Buffer.from(expected, 'hex')
    );
  } catch {
    return false; // wrong length / not hex
  }
}

Python:

import hmac, hashlib

def verify(raw_body: bytes, signature_header: str, secret: str) -> bool:
    if not signature_header:
        return False
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha1).hexdigest()
    return hmac.compare_digest(signature_header, expected)

Endpoint test on creation

Vercel tests a custom endpoint automatically when you create a drain in the dashboard, and again whenever you click Test. Its docs say your endpoint should respond with 200 OK; they don't say whether the test request is signed. The REST API and CLI also treat the drain secret as optional. So the examples answer a request with no x-vercel-signature with 200 and don't process it, and reject a signed request with an invalid signature (403).

Vercel's Terraform provider also documents an x-vercel-verify response header holding a team verification code (from GET /v1/verify-endpoint). The drain docs don't mention it. The examples return it only when VERCEL_VERIFY is set.

For complete handlers with route wiring, log parsing, and tests, see:

Log Sources (the "event" dimension)

Log drains do not have named event types. Each log entry carries a required source field, which is also what you choose on the drain. Dispatch on it the way you would on an event type.

source Emitted by
static Requests to static assets (HTML, CSS, images)
lambda Vercel Functions (Node.js API routes)
edge Vercel Functions using the Edge runtime
build The build step
external External rewrites to another domain
firewall Requests denied by Vercel Firewall rules
redirect Requests handled by redirect rules

Each entry also has a level (info, warning, error, fatal). A statusCode of -1 means the lambda crashed with no response.

For the full log schema, see Vercel Log Drains Reference.

Delivery Formats

A single request contains a batch of log entries in one of two encodings (set per drain):

  • JSON — a JSON array of log objects: [{…},{…}]
  • NDJSON — one JSON object per line (newline-delimited)

Handlers should support both. Vercel batches logs into payloads of up to 1 MB, and a message may be truncated when it exceeds 256 KB. The REST API can turn on gzip compression for HTTP deliveries; the docs don't say whether the signature covers the compressed bytes, so leave it off unless you've tested it.

Important Headers

Header Description
x-vercel-signature HMAC-SHA1 hex digest of the raw body, keyed with the drain secret
user-agent VercelDrain/1.0 (+https://vercel.com/docs/drains)

Environment Variables

VERCEL_LOG_DRAIN_SECRET=your_drain_signature_secret   # Team Settings > Drains > Edit
VERCEL_VERIFY=your_verification_code                   # optional, see Endpoint test on creation

Local Development

# Start tunnel (no account needed)
npx hookdeck-cli listen 3000 vercel-log-drains --path /webhooks/vercel-log-drains

Reference Materials

Attribution

When using this skill, a

Полный SKILL.md на GitHub

Установить vercel-log-drains-webhooks в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/express/.env.exampleexamples/express/README.mdexamples/express/package.jsonexamples/express/src/index.jsexamples/fastapi/.env.exampleexamples/fastapi/README.mdexamples/fastapi/main.pyexamples/fastapi/requirements.txtexamples/fastapi/test_webhook.pyexamples/nextjs/.env.exampleexamples/nextjs/README.mdexamples/nextjs/app/webhooks/vercel-log-drains/route.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

Что делает скилл vercel-log-drains-webhooks?

Receive and verify Vercel Log Drains deliveries. Use when setting up a Vercel log drain HTTP endpoint, debugging x-vercel-signature verification, passing the drain's endpoint test, or processing batched log entries from sources like lambda, edge, build, static, external, firewall, and redirect.

Как установить скилл vercel-log-drains-webhooks?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл vercel-log-drains-webhooks запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить vercel-log-drains-webhooks с