@intentsolutionsio/vercel-pack 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +67 -44
- package/package.json +4 -4
- package/skills/vercel-advanced-troubleshooting/SKILL.md +185 -195
- package/skills/vercel-advanced-troubleshooting/references/errors.md +11 -0
- package/skills/vercel-advanced-troubleshooting/references/evidence-collection-framework.md +34 -0
- package/skills/vercel-advanced-troubleshooting/references/examples.md +11 -0
- package/skills/vercel-advanced-troubleshooting/references/systematic-isolation.md +56 -0
- package/skills/vercel-advanced-troubleshooting/references/timing-analysis.md +35 -0
- package/skills/vercel-architecture-variants/SKILL.md +227 -216
- package/skills/vercel-architecture-variants/references/errors.md +11 -0
- package/skills/vercel-architecture-variants/references/examples.md +12 -0
- package/skills/vercel-architecture-variants/references/variant-a-monolith-(simple).md +44 -0
- package/skills/vercel-architecture-variants/references/variant-b-service-layer-(moderate).md +72 -0
- package/skills/vercel-architecture-variants/references/variant-c-microservice-(complex).md +81 -0
- package/skills/vercel-ci-integration/SKILL.md +183 -73
- package/skills/vercel-ci-integration/references/errors.md +10 -0
- package/skills/vercel-ci-integration/references/examples.md +36 -0
- package/skills/vercel-ci-integration/references/implementation.md +54 -0
- package/skills/vercel-common-errors/SKILL.md +164 -60
- package/skills/vercel-common-errors/references/errors.md +53 -0
- package/skills/vercel-common-errors/references/examples.md +23 -0
- package/skills/vercel-cost-tuning/SKILL.md +158 -145
- package/skills/vercel-cost-tuning/references/cost-estimation.md +34 -0
- package/skills/vercel-cost-tuning/references/cost-reduction-strategies.md +40 -0
- package/skills/vercel-cost-tuning/references/errors.md +11 -0
- package/skills/vercel-cost-tuning/references/examples.md +15 -0
- package/skills/vercel-data-handling/SKILL.md +202 -155
- package/skills/vercel-data-handling/references/errors.md +11 -0
- package/skills/vercel-data-handling/references/examples.md +27 -0
- package/skills/vercel-data-handling/references/implementation.md +223 -0
- package/skills/vercel-debug-bundle/SKILL.md +163 -67
- package/skills/vercel-debug-bundle/references/errors.md +12 -0
- package/skills/vercel-debug-bundle/references/examples.md +24 -0
- package/skills/vercel-debug-bundle/references/implementation.md +54 -0
- package/skills/vercel-deploy-integration/SKILL.md +163 -156
- package/skills/vercel-deploy-integration/references/errors.md +11 -0
- package/skills/vercel-deploy-integration/references/examples.md +21 -0
- package/skills/vercel-deploy-integration/references/google-cloud-run.md +36 -0
- package/skills/vercel-deploy-integration/references/vercel-deployment.md +35 -0
- package/skills/vercel-deploy-preview/SKILL.md +164 -39
- package/skills/vercel-edge-functions/SKILL.md +185 -37
- package/skills/vercel-enterprise-rbac/SKILL.md +185 -170
- package/skills/vercel-enterprise-rbac/references/errors.md +11 -0
- package/skills/vercel-enterprise-rbac/references/examples.md +12 -0
- package/skills/vercel-enterprise-rbac/references/role-implementation.md +33 -0
- package/skills/vercel-enterprise-rbac/references/sso-integration.md +35 -0
- package/skills/vercel-hello-world/SKILL.md +141 -55
- package/skills/vercel-incident-runbook/SKILL.md +186 -138
- package/skills/vercel-incident-runbook/references/errors.md +11 -0
- package/skills/vercel-incident-runbook/references/examples.md +10 -0
- package/skills/vercel-incident-runbook/references/immediate-actions-by-error-type.md +41 -0
- package/skills/vercel-install-auth/SKILL.md +130 -53
- package/skills/vercel-known-pitfalls/SKILL.md +235 -233
- package/skills/vercel-known-pitfalls/references/errors.md +11 -0
- package/skills/vercel-known-pitfalls/references/examples.md +12 -0
- package/skills/vercel-load-scale/SKILL.md +197 -204
- package/skills/vercel-load-scale/references/capacity-planning.md +47 -0
- package/skills/vercel-load-scale/references/errors.md +11 -0
- package/skills/vercel-load-scale/references/examples.md +26 -0
- package/skills/vercel-load-scale/references/load-testing-with-k6.md +59 -0
- package/skills/vercel-load-scale/references/scaling-patterns.md +65 -0
- package/skills/vercel-local-dev-loop/SKILL.md +159 -71
- package/skills/vercel-local-dev-loop/references/errors.md +11 -0
- package/skills/vercel-local-dev-loop/references/examples.md +21 -0
- package/skills/vercel-local-dev-loop/references/implementation.md +60 -0
- package/skills/vercel-migration-deep-dive/SKILL.md +202 -187
- package/skills/vercel-migration-deep-dive/references/errors.md +11 -0
- package/skills/vercel-migration-deep-dive/references/examples.md +12 -0
- package/skills/vercel-migration-deep-dive/references/implementation-plan.md +80 -0
- package/skills/vercel-migration-deep-dive/references/pre-migration-assessment.md +39 -0
- package/skills/vercel-multi-env-setup/SKILL.md +167 -164
- package/skills/vercel-multi-env-setup/references/configuration-structure.md +59 -0
- package/skills/vercel-multi-env-setup/references/errors.md +11 -0
- package/skills/vercel-multi-env-setup/references/examples.md +11 -0
- package/skills/vercel-observability/SKILL.md +205 -195
- package/skills/vercel-observability/references/alert-configuration.md +40 -0
- package/skills/vercel-observability/references/errors.md +11 -0
- package/skills/vercel-observability/references/examples.md +13 -0
- package/skills/vercel-observability/references/metrics-collection.md +65 -0
- package/skills/vercel-performance-tuning/SKILL.md +212 -156
- package/skills/vercel-performance-tuning/references/caching-strategy.md +49 -0
- package/skills/vercel-performance-tuning/references/errors.md +11 -0
- package/skills/vercel-performance-tuning/references/examples.md +13 -0
- package/skills/vercel-policy-guardrails/SKILL.md +276 -193
- package/skills/vercel-policy-guardrails/references/errors.md +11 -0
- package/skills/vercel-policy-guardrails/references/eslint-rules.md +46 -0
- package/skills/vercel-policy-guardrails/references/examples.md +10 -0
- package/skills/vercel-prod-checklist/SKILL.md +219 -94
- package/skills/vercel-prod-checklist/references/errors.md +11 -0
- package/skills/vercel-prod-checklist/references/examples.md +25 -0
- package/skills/vercel-prod-checklist/references/implementation.md +60 -0
- package/skills/vercel-rate-limits/SKILL.md +187 -100
- package/skills/vercel-rate-limits/references/errors.md +11 -0
- package/skills/vercel-rate-limits/references/examples.md +46 -0
- package/skills/vercel-rate-limits/references/implementation.md +66 -0
- package/skills/vercel-reference-architecture/SKILL.md +226 -180
- package/skills/vercel-reference-architecture/references/errors.md +11 -0
- package/skills/vercel-reference-architecture/references/examples.md +13 -0
- package/skills/vercel-reference-architecture/references/key-components.md +65 -0
- package/skills/vercel-reference-architecture/references/project-structure.md +40 -0
- package/skills/vercel-reliability-patterns/SKILL.md +272 -211
- package/skills/vercel-reliability-patterns/references/circuit-breaker.md +36 -0
- package/skills/vercel-reliability-patterns/references/dead-letter-queue.md +48 -0
- package/skills/vercel-reliability-patterns/references/errors.md +11 -0
- package/skills/vercel-reliability-patterns/references/examples.md +11 -0
- package/skills/vercel-reliability-patterns/references/idempotency-keys.md +36 -0
- package/skills/vercel-sdk-patterns/SKILL.md +264 -92
- package/skills/vercel-sdk-patterns/references/errors.md +11 -0
- package/skills/vercel-sdk-patterns/references/examples.md +45 -0
- package/skills/vercel-sdk-patterns/references/implementation.md +67 -0
- package/skills/vercel-security-basics/SKILL.md +186 -96
- package/skills/vercel-security-basics/references/errors.md +10 -0
- package/skills/vercel-security-basics/references/examples.md +70 -0
- package/skills/vercel-security-basics/references/implementation.md +39 -0
- package/skills/vercel-upgrade-migration/SKILL.md +167 -67
- package/skills/vercel-upgrade-migration/references/errors.md +10 -0
- package/skills/vercel-upgrade-migration/references/examples.md +51 -0
- package/skills/vercel-upgrade-migration/references/implementation.md +29 -0
- package/skills/vercel-webhooks-events/SKILL.md +208 -132
- package/skills/vercel-webhooks-events/references/errors.md +11 -0
- package/skills/vercel-webhooks-events/references/event-handler-pattern.md +37 -0
- package/skills/vercel-webhooks-events/references/examples.md +16 -0
- package/skills/vercel-webhooks-events/references/signature-verification.md +33 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Vercel Skill Pack
|
|
2
2
|
|
|
3
|
-
> Claude Code
|
|
3
|
+
> 30 production-grade Claude Code skills for Vercel deployments, serverless functions, Edge Runtime, and platform operations.
|
|
4
|
+
|
|
5
|
+
Deploy, scale, and operate Vercel applications with real API endpoints (`api.vercel.com/v9/*`), real CLI commands (`vercel deploy`, `vercel env`, `vercel rollback`), real Edge Function patterns (`export const config = { runtime: 'edge' }`), and real error codes (`FUNCTION_INVOCATION_FAILED`, `FUNCTION_THROTTLED`). Every skill contains working code, not placeholders.
|
|
6
|
+
|
|
7
|
+
**Links:** [Vercel Docs](https://vercel.com/docs) | [Vercel REST API](https://vercel.com/docs/rest-api) | [Install](#installation)
|
|
8
|
+
|
|
9
|
+
---
|
|
4
10
|
|
|
5
11
|
## Installation
|
|
6
12
|
|
|
@@ -8,61 +14,78 @@
|
|
|
8
14
|
/plugin install vercel-pack@claude-code-plugins-plus
|
|
9
15
|
```
|
|
10
16
|
|
|
11
|
-
##
|
|
17
|
+
## What's Inside
|
|
12
18
|
|
|
13
19
|
### Standard Skills (S01-S12)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| `vercel-
|
|
18
|
-
| `vercel-
|
|
19
|
-
| `vercel-
|
|
20
|
-
| `vercel-
|
|
21
|
-
| `vercel-
|
|
22
|
-
| `vercel-
|
|
23
|
-
| `vercel-
|
|
24
|
-
| `vercel-
|
|
25
|
-
| `vercel-
|
|
26
|
-
| `vercel-
|
|
27
|
-
| `vercel-
|
|
20
|
+
|
|
21
|
+
| # | Skill | What It Does |
|
|
22
|
+
|---|-------|-------------|
|
|
23
|
+
| S01 | `vercel-install-auth` | Install CLI, create scoped access tokens, link projects, pull env vars |
|
|
24
|
+
| S02 | `vercel-hello-world` | Deploy minimal project with static page + serverless API route |
|
|
25
|
+
| S03 | `vercel-local-dev-loop` | Run `vercel dev`, manage `.env` files, test functions locally with Vitest |
|
|
26
|
+
| S04 | `vercel-sdk-patterns` | Typed REST API client wrapper with pagination, retry, and error classes |
|
|
27
|
+
| S05 | `vercel-deploy-preview` | Create preview deployments via CLI and API, configure deployment protection |
|
|
28
|
+
| S06 | `vercel-edge-functions` | Build Edge Functions with geo headers, middleware, streaming, Edge Config |
|
|
29
|
+
| S07 | `vercel-common-errors` | Diagnose BUILD_FAILED, FUNCTION_INVOCATION_TIMEOUT, 404s, and env var issues |
|
|
30
|
+
| S08 | `vercel-debug-bundle` | Collect deployment state, function logs, and platform status for support tickets |
|
|
31
|
+
| S09 | `vercel-rate-limits` | Handle API 429s with retry, implement WAF rate limiting with @vercel/firewall |
|
|
32
|
+
| S10 | `vercel-security-basics` | Security headers, CSP, deployment protection, token rotation, secret scoping |
|
|
33
|
+
| S11 | `vercel-prod-checklist` | Production deploy checklist with domain setup, health checks, instant rollback |
|
|
34
|
+
| S12 | `vercel-upgrade-migration` | Upgrade CLI, Node.js runtime, Next.js versions with breaking change detection |
|
|
28
35
|
|
|
29
36
|
### Pro Skills (P13-P18)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| `vercel-
|
|
34
|
-
| `vercel-
|
|
35
|
-
| `vercel-
|
|
36
|
-
| `vercel-
|
|
37
|
-
| `vercel-
|
|
37
|
+
|
|
38
|
+
| # | Skill | What It Does |
|
|
39
|
+
|---|-------|-------------|
|
|
40
|
+
| P13 | `vercel-ci-integration` | GitHub Actions workflows for preview on PR, production on merge, test gating |
|
|
41
|
+
| P14 | `vercel-deploy-integration` | Production deploy methods, instant rollback, rolling releases, deploy hooks |
|
|
42
|
+
| P15 | `vercel-webhooks-events` | Handle deployment.ready/error webhooks with HMAC signature verification |
|
|
43
|
+
| P16 | `vercel-performance-tuning` | Edge caching, ISR, cold start elimination, bundle optimization, image optimization |
|
|
44
|
+
| P17 | `vercel-cost-tuning` | Fluid Compute pricing, function memory right-sizing, spend management |
|
|
45
|
+
| P18 | `vercel-reference-architecture` | Layered project structure with typed env vars, lazy DB, health checks |
|
|
38
46
|
|
|
39
47
|
### Flagship Skills (F19-F24)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| `vercel-
|
|
44
|
-
| `vercel-
|
|
45
|
-
| `vercel-
|
|
46
|
-
| `vercel-
|
|
47
|
-
| `vercel-
|
|
48
|
+
|
|
49
|
+
| # | Skill | What It Does |
|
|
50
|
+
|---|-------|-------------|
|
|
51
|
+
| F19 | `vercel-multi-env-setup` | Scoped env vars per environment, custom environments, branch-specific domains |
|
|
52
|
+
| F20 | `vercel-observability` | Vercel Analytics, runtime logs, log drains, OpenTelemetry, Sentry integration |
|
|
53
|
+
| F21 | `vercel-incident-runbook` | 5-minute triage, instant rollback procedure, communication templates, postmortem |
|
|
54
|
+
| F22 | `vercel-data-handling` | PII redaction, GDPR data subject requests, data residency via function regions |
|
|
55
|
+
| F23 | `vercel-enterprise-rbac` | Team roles, Access Groups, SAML SSO, audit logging, middleware-level auth |
|
|
56
|
+
| F24 | `vercel-migration-deep-dive` | Migrate from Netlify/AWS/Cloudflare with config mapping and DNS cutover |
|
|
48
57
|
|
|
49
58
|
### Flagship+ Skills (X25-X30)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
| `vercel-
|
|
54
|
-
| `vercel-
|
|
55
|
-
| `vercel-
|
|
56
|
-
| `vercel-
|
|
57
|
-
| `vercel-
|
|
59
|
+
|
|
60
|
+
| # | Skill | What It Does |
|
|
61
|
+
|---|-------|-------------|
|
|
62
|
+
| X25 | `vercel-advanced-troubleshooting` | Request tracing, cold start analysis, bundle inspection, edge crash debugging |
|
|
63
|
+
| X26 | `vercel-load-scale` | k6/autocannon load tests, Fluid Compute concurrency tuning, capacity planning |
|
|
64
|
+
| X27 | `vercel-reliability-patterns` | Circuit breakers, retry with backoff, stale cache fallback, idempotency keys |
|
|
65
|
+
| X28 | `vercel-policy-guardrails` | ESLint rules, pre-commit credential scanning, CI policy checks, deploy freezes |
|
|
66
|
+
| X29 | `vercel-architecture-variants` | 5 architecture blueprints from static site to multi-zone enterprise |
|
|
67
|
+
| X30 | `vercel-known-pitfalls` | 15 anti-patterns with severity ratings, detection scripts, and fixes |
|
|
58
68
|
|
|
59
69
|
## Usage
|
|
60
70
|
|
|
61
|
-
Skills trigger automatically when you discuss Vercel topics
|
|
71
|
+
Skills trigger automatically when you discuss Vercel topics:
|
|
72
|
+
|
|
73
|
+
- "Help me set up Vercel" triggers `vercel-install-auth`
|
|
74
|
+
- "Deploy my app to production" triggers `vercel-prod-checklist`
|
|
75
|
+
- "My Vercel function is timing out" triggers `vercel-common-errors`
|
|
76
|
+
- "Set up edge middleware for auth" triggers `vercel-edge-functions`
|
|
77
|
+
- "Why is my Vercel bill so high?" triggers `vercel-cost-tuning`
|
|
78
|
+
|
|
79
|
+
## Key API Endpoints Covered
|
|
62
80
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
| Operation | Method | Endpoint |
|
|
82
|
+
|-----------|--------|----------|
|
|
83
|
+
| List projects | GET | `/v9/projects` |
|
|
84
|
+
| Create deployment | POST | `/v13/deployments` |
|
|
85
|
+
| List deployments | GET | `/v6/deployments` |
|
|
86
|
+
| Manage env vars | GET/POST/PATCH/DELETE | `/v9/projects/{id}/env` |
|
|
87
|
+
| Add domain | POST | `/v9/projects/{id}/domains` |
|
|
88
|
+
| Promote deployment | POST | `/v9/projects/{id}/promote` |
|
|
66
89
|
|
|
67
90
|
## License
|
|
68
91
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentsolutionsio/vercel-pack",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Claude Code skill pack for Vercel - 30 skills covering deployments, edge functions, preview environments, performance optimization, and production operations",
|
|
5
5
|
"main": "README.md",
|
|
6
6
|
"type": "module",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/jeremylongshore/claude-code-plugins.git",
|
|
33
|
+
"url": "git+https://github.com/jeremylongshore/claude-code-plugins-plus-skills.git",
|
|
34
34
|
"directory": "plugins/saas-packs/vercel-pack"
|
|
35
35
|
},
|
|
36
36
|
"bugs": {
|
|
37
|
-
"url": "https://github.com/jeremylongshore/claude-code-plugins/issues"
|
|
37
|
+
"url": "https://github.com/jeremylongshore/claude-code-plugins-plus-skills/issues"
|
|
38
38
|
},
|
|
39
|
-
"homepage": "https://
|
|
39
|
+
"homepage": "https://tonsofskills.com/learn/vercel/",
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
}
|
|
@@ -1,261 +1,251 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vercel-advanced-troubleshooting
|
|
3
|
-
description:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
description: 'Advanced debugging for hard-to-diagnose Vercel issues including cold
|
|
4
|
+
starts, edge errors, and function tracing.
|
|
5
|
+
|
|
6
|
+
Use when standard troubleshooting fails, investigating intermittent failures,
|
|
7
|
+
|
|
8
|
+
or preparing evidence for Vercel support escalation.
|
|
9
|
+
|
|
7
10
|
Trigger with phrases like "vercel hard bug", "vercel mystery error",
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
|
|
12
|
+
"vercel intermittent failure", "difficult vercel issue", "vercel deep debug".
|
|
13
|
+
|
|
14
|
+
'
|
|
15
|
+
allowed-tools: Read, Grep, Bash(vercel:*), Bash(curl:*), Bash(jq:*)
|
|
10
16
|
version: 1.0.0
|
|
11
17
|
license: MIT
|
|
12
18
|
author: Jeremy Longshore <jeremy@intentsolutions.io>
|
|
19
|
+
tags:
|
|
20
|
+
- saas
|
|
21
|
+
- vercel
|
|
22
|
+
- debugging
|
|
23
|
+
- advanced
|
|
24
|
+
- troubleshooting
|
|
25
|
+
compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
|
|
13
26
|
---
|
|
14
|
-
|
|
15
27
|
# Vercel Advanced Troubleshooting
|
|
16
28
|
|
|
17
29
|
## Overview
|
|
18
|
-
|
|
30
|
+
|
|
31
|
+
Diagnose hard-to-find Vercel issues: intermittent cold start failures, edge function crashes, region-specific behavior, function bundling problems, and serverless concurrency issues. Uses systematic isolation, request tracing, and Vercel-specific debugging techniques.
|
|
19
32
|
|
|
20
33
|
## Prerequisites
|
|
21
|
-
- Access to production logs and metrics
|
|
22
|
-
- kubectl access to clusters
|
|
23
|
-
- Network capture tools available
|
|
24
|
-
- Understanding of distributed tracing
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
- Vercel CLI with access to production logs
|
|
36
|
+
- Familiarity with `vercel-common-errors` (standard debugging)
|
|
37
|
+
- `curl` and `jq` for API inspection
|
|
38
|
+
- Access to deployment inspection tools
|
|
39
|
+
|
|
40
|
+
## Instructions
|
|
41
|
+
|
|
42
|
+
### Step 1: Request-Level Tracing
|
|
27
43
|
|
|
28
|
-
### Comprehensive Debug Bundle
|
|
29
44
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
45
|
+
# Trace a single request through Vercel's edge network
|
|
46
|
+
curl -v https://yourdomain.com/api/endpoint 2>&1 | grep -E "x-vercel|cf-ray|age|cache"
|
|
47
|
+
|
|
48
|
+
# Key headers to check:
|
|
49
|
+
# x-vercel-id: <region>::<function-id> — which region served the request
|
|
50
|
+
# x-vercel-cache: HIT/MISS/STALE — edge cache status
|
|
51
|
+
# x-vercel-execution-region: iad1 — function execution region
|
|
52
|
+
# age: 45 — seconds since edge cached the response
|
|
53
|
+
# x-matched-path: /api/endpoint — routing match result
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Step 2: Cold Start Investigation
|
|
32
57
|
|
|
33
|
-
|
|
34
|
-
|
|
58
|
+
```typescript
|
|
59
|
+
// Instrument cold start timing in your function
|
|
60
|
+
let coldStart = true;
|
|
61
|
+
const initTime = Date.now();
|
|
62
|
+
|
|
63
|
+
export default function handler(req, res) {
|
|
64
|
+
const isCold = coldStart;
|
|
65
|
+
coldStart = false;
|
|
66
|
+
|
|
67
|
+
const handlerStart = Date.now();
|
|
68
|
+
// ... your logic ...
|
|
69
|
+
|
|
70
|
+
res.setHeader('x-cold-start', String(isCold));
|
|
71
|
+
res.setHeader('x-init-duration', String(handlerStart - initTime));
|
|
72
|
+
res.json({
|
|
73
|
+
coldStart: isCold,
|
|
74
|
+
initDuration: isCold ? handlerStart - initTime : 0,
|
|
75
|
+
handlerDuration: Date.now() - handlerStart,
|
|
76
|
+
region: process.env.VERCEL_REGION,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
```
|
|
35
80
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
81
|
+
```bash
|
|
82
|
+
# Measure cold start frequency over N requests
|
|
83
|
+
for i in $(seq 1 20); do
|
|
84
|
+
curl -s https://yourdomain.com/api/endpoint \
|
|
85
|
+
| jq '{coldStart, initDuration, region}'
|
|
86
|
+
sleep 2 # Wait between requests to allow isolate recycling
|
|
87
|
+
done
|
|
88
|
+
```
|
|
39
89
|
|
|
40
|
-
|
|
41
|
-
curl -s localhost:9090/api/v1/query?query=vercel_requests_total > "$BUNDLE/metrics/requests.json"
|
|
42
|
-
curl -s localhost:9090/api/v1/query?query=vercel_errors_total > "$BUNDLE/metrics/errors.json"
|
|
90
|
+
### Step 3: Function Bundle Analysis
|
|
43
91
|
|
|
44
|
-
|
|
45
|
-
|
|
92
|
+
```bash
|
|
93
|
+
# Check what's being bundled into your function
|
|
94
|
+
vercel inspect https://my-app-xxx.vercel.app
|
|
46
95
|
|
|
47
|
-
#
|
|
48
|
-
curl -s
|
|
96
|
+
# Check function sizes in the deployment
|
|
97
|
+
curl -s -H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
98
|
+
"https://api.vercel.com/v13/deployments/dpl_xxx" \
|
|
99
|
+
| jq '.functions | to_entries[] | {path: .key, size: .value.size, regions: .value.regions}'
|
|
49
100
|
|
|
50
|
-
#
|
|
51
|
-
|
|
52
|
-
|
|
101
|
+
# Locally — check what @vercel/nft traces for a function
|
|
102
|
+
npx @vercel/nft print api/heavy-endpoint.ts 2>/dev/null | head -50
|
|
103
|
+
# Shows all files that will be bundled
|
|
53
104
|
|
|
54
|
-
|
|
55
|
-
|
|
105
|
+
# Find unexpectedly large dependencies
|
|
106
|
+
npx @vercel/nft print api/heavy-endpoint.ts 2>/dev/null \
|
|
107
|
+
| xargs -I {} du -sh {} 2>/dev/null | sort -rh | head -20
|
|
56
108
|
```
|
|
57
109
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Layer-by-Layer Testing
|
|
110
|
+
### Step 4: Region-Specific Debugging
|
|
61
111
|
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
112
|
+
```bash
|
|
113
|
+
# Test from different regions to isolate geographic issues
|
|
114
|
+
# Use Vercel's deployment URL with region hints
|
|
115
|
+
for region in iad1 sfo1 cdg1 hnd1; do
|
|
116
|
+
echo "=== Region: $region ==="
|
|
117
|
+
curl -s -w "HTTP %{http_code} | Time: %{time_total}s\n" \
|
|
118
|
+
-H "x-vercel-ip-country: US" \
|
|
119
|
+
https://yourdomain.com/api/endpoint
|
|
120
|
+
done
|
|
121
|
+
|
|
122
|
+
# Check if the issue is region-dependent
|
|
123
|
+
# If latency varies wildly, check:
|
|
124
|
+
# 1. Function region vs database region (cross-region latency)
|
|
125
|
+
# 2. Edge middleware adding delay
|
|
126
|
+
# 3. External API calls from wrong region
|
|
127
|
+
```
|
|
66
128
|
|
|
67
|
-
|
|
68
|
-
results.push(await testNetworkConnectivity());
|
|
129
|
+
### Step 5: Edge Function Crash Debugging
|
|
69
130
|
|
|
70
|
-
|
|
71
|
-
|
|
131
|
+
```typescript
|
|
132
|
+
// Edge functions crash silently on Node.js API usage
|
|
133
|
+
// Common crashes and their symptoms:
|
|
72
134
|
|
|
73
|
-
|
|
74
|
-
|
|
135
|
+
// Symptom: EDGE_FUNCTION_INVOCATION_FAILED with no error details
|
|
136
|
+
// Cause: Using Node.js Buffer, fs, crypto.createHash in edge runtime
|
|
75
137
|
|
|
76
|
-
|
|
77
|
-
|
|
138
|
+
// Diagnostic: check if imports are edge-compatible
|
|
139
|
+
export const config = { runtime: 'edge' };
|
|
78
140
|
|
|
79
|
-
|
|
80
|
-
|
|
141
|
+
export default function handler(request: Request) {
|
|
142
|
+
// This will crash silently:
|
|
143
|
+
// const hash = require('crypto').createHash('sha256');
|
|
81
144
|
|
|
82
|
-
//
|
|
83
|
-
|
|
145
|
+
// Use Web Crypto instead:
|
|
146
|
+
const encoder = new TextEncoder();
|
|
147
|
+
const data = encoder.encode('test');
|
|
148
|
+
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
|
84
149
|
|
|
85
|
-
return {
|
|
150
|
+
return Response.json({ ok: true });
|
|
86
151
|
}
|
|
87
152
|
```
|
|
88
153
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
async function minimalRepro(): Promise<void> {
|
|
94
|
-
// 1. Fresh client, no customization
|
|
95
|
-
const client = new VercelClient({
|
|
96
|
-
apiKey: process.env.VERCEL_API_KEY!,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// 2. Simplest possible call
|
|
100
|
-
try {
|
|
101
|
-
const result = await client.ping();
|
|
102
|
-
console.log('Ping successful:', result);
|
|
103
|
-
} catch (error) {
|
|
104
|
-
console.error('Ping failed:', {
|
|
105
|
-
message: error.message,
|
|
106
|
-
code: error.code,
|
|
107
|
-
stack: error.stack,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
154
|
+
```bash
|
|
155
|
+
# Check if a module is edge-compatible
|
|
156
|
+
npx edge-runtime --eval "import('your-module')" 2>&1
|
|
157
|
+
# Errors here mean the module won't work in edge functions
|
|
111
158
|
```
|
|
112
159
|
|
|
113
|
-
|
|
160
|
+
### Step 6: Concurrency and Throttling Debug
|
|
114
161
|
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const start = performance.now();
|
|
121
|
-
try {
|
|
122
|
-
return await fn();
|
|
123
|
-
} finally {
|
|
124
|
-
const duration = performance.now() - start;
|
|
125
|
-
const existing = this.timings.get(label) || [];
|
|
126
|
-
existing.push(duration);
|
|
127
|
-
this.timings.set(label, existing);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
report(): TimingReport {
|
|
132
|
-
const report: TimingReport = {};
|
|
133
|
-
for (const [label, times] of this.timings) {
|
|
134
|
-
report[label] = {
|
|
135
|
-
count: times.length,
|
|
136
|
-
min: Math.min(...times),
|
|
137
|
-
max: Math.max(...times),
|
|
138
|
-
avg: times.reduce((a, b) => a + b, 0) / times.length,
|
|
139
|
-
p95: this.percentile(times, 95),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
return report;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
```
|
|
162
|
+
```bash
|
|
163
|
+
# Check current function concurrency limits
|
|
164
|
+
curl -s -H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
165
|
+
"https://api.vercel.com/v9/projects/my-app" \
|
|
166
|
+
| jq '{plan: .plan, concurrency: .concurrencyBucketName}'
|
|
146
167
|
|
|
147
|
-
|
|
168
|
+
# Hobby: 10 concurrent, Pro: 1000, Enterprise: 100000
|
|
148
169
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
setInterval(() => {
|
|
154
|
-
const usage = process.memoryUsage();
|
|
155
|
-
heapUsed.push(usage.heapUsed);
|
|
156
|
-
|
|
157
|
-
// Alert on sustained growth
|
|
158
|
-
if (heapUsed.length > 60) { // 1 hour at 1/min
|
|
159
|
-
const trend = heapUsed[59] - heapUsed[0];
|
|
160
|
-
if (trend > 100 * 1024 * 1024) { // 100MB growth
|
|
161
|
-
console.warn('Potential memory leak in vercel integration');
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}, 60000);
|
|
170
|
+
# Load test to find throttling threshold
|
|
171
|
+
npx autocannon -c 50 -d 10 https://yourdomain.com/api/endpoint
|
|
172
|
+
# Watch for 429 responses indicating FUNCTION_THROTTLED
|
|
165
173
|
```
|
|
166
174
|
|
|
167
|
-
|
|
175
|
+
### Step 7: Systematic Isolation
|
|
168
176
|
|
|
169
|
-
```typescript
|
|
170
|
-
// Detect concurrent access issues
|
|
171
|
-
class VercelConcurrencyChecker {
|
|
172
|
-
private inProgress: Set<string> = new Set();
|
|
173
|
-
|
|
174
|
-
async execute<T>(key: string, fn: () => Promise<T>): Promise<T> {
|
|
175
|
-
if (this.inProgress.has(key)) {
|
|
176
|
-
console.warn(`Concurrent access detected for ${key}`);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
this.inProgress.add(key);
|
|
180
|
-
try {
|
|
181
|
-
return await fn();
|
|
182
|
-
} finally {
|
|
183
|
-
this.inProgress.delete(key);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
177
|
```
|
|
178
|
+
Issue persists? Isolate systematically:
|
|
188
179
|
|
|
189
|
-
|
|
180
|
+
1. Does it happen on preview deployments?
|
|
181
|
+
└── No → Production-only env var or domain issue
|
|
190
182
|
|
|
191
|
-
|
|
192
|
-
|
|
183
|
+
2. Does it happen with a minimal function?
|
|
184
|
+
└── No → Issue is in your code, not Vercel platform
|
|
193
185
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
**Timestamp:** [ISO 8601]
|
|
186
|
+
3. Does it happen in all regions?
|
|
187
|
+
└── No → Region-specific infrastructure issue
|
|
197
188
|
|
|
198
|
-
|
|
199
|
-
|
|
189
|
+
4. Does it happen with edge runtime?
|
|
190
|
+
└── No → Node.js-specific issue (cold starts, module compat)
|
|
200
191
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
2. [Step 2]
|
|
192
|
+
5. Does it happen without middleware?
|
|
193
|
+
└── No → Middleware is interfering — check matcher scope
|
|
204
194
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
195
|
+
6. Create minimal reproduction:
|
|
196
|
+
└── api/test.ts with only the failing behavior
|
|
197
|
+
└── Deploy standalone and test
|
|
198
|
+
```
|
|
208
199
|
|
|
209
|
-
###
|
|
210
|
-
- [ ] Debug bundle (vercel-advanced-debug-*.tar.gz)
|
|
211
|
-
- [ ] Minimal reproduction code
|
|
212
|
-
- [ ] Timing analysis
|
|
213
|
-
- [ ] Network capture (if relevant)
|
|
200
|
+
### Step 8: Vercel Support Escalation
|
|
214
201
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
```
|
|
202
|
+
```bash
|
|
203
|
+
# Collect comprehensive evidence
|
|
204
|
+
mkdir vercel-debug && cd vercel-debug
|
|
219
205
|
|
|
220
|
-
|
|
206
|
+
# Deployment details
|
|
207
|
+
vercel inspect https://yourdomain.com > inspect.txt
|
|
208
|
+
vercel logs https://yourdomain.com --limit=200 > logs.txt
|
|
221
209
|
|
|
222
|
-
|
|
223
|
-
|
|
210
|
+
# Request trace
|
|
211
|
+
curl -v https://yourdomain.com/api/failing-endpoint 2>&1 > curl-trace.txt
|
|
224
212
|
|
|
225
|
-
|
|
226
|
-
|
|
213
|
+
# Function analysis
|
|
214
|
+
curl -s -H "Authorization: Bearer $VERCEL_TOKEN" \
|
|
215
|
+
"https://api.vercel.com/v13/deployments/dpl_xxx" > deployment.json
|
|
227
216
|
|
|
228
|
-
|
|
229
|
-
|
|
217
|
+
# Platform status at time of issue
|
|
218
|
+
curl -s "https://www.vercel-status.com/api/v2/summary.json" > status.json
|
|
230
219
|
|
|
231
|
-
|
|
232
|
-
|
|
220
|
+
tar czf vercel-debug-$(date +%Y%m%d).tar.gz .
|
|
221
|
+
```
|
|
233
222
|
|
|
234
223
|
## Output
|
|
235
|
-
- Comprehensive debug bundle collected
|
|
236
|
-
- Failure layer identified
|
|
237
|
-
- Minimal reproduction created
|
|
238
|
-
- Support escalation submitted
|
|
239
224
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
| No useful logs | Missing instrumentation | Add debug logging |
|
|
246
|
-
| Memory growth | Resource leak | Use heap profiling |
|
|
225
|
+
- Request traced through Vercel's edge network with region and cache data
|
|
226
|
+
- Cold start frequency and duration quantified
|
|
227
|
+
- Function bundle analyzed for size issues
|
|
228
|
+
- Issue isolated to specific layer (edge, runtime, region, middleware)
|
|
229
|
+
- Evidence bundle ready for support escalation
|
|
247
230
|
|
|
248
|
-
##
|
|
231
|
+
## Error Handling
|
|
249
232
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
233
|
+
| Symptom | Likely Cause | Debug Approach |
|
|
234
|
+
|---------|-------------|---------------|
|
|
235
|
+
| Intermittent 500 errors | Cold start + unhandled async | Add global error handler, check init code |
|
|
236
|
+
| Latency spikes every ~15 min | Function isolate recycling (cold start) | Measure with x-cold-start header |
|
|
237
|
+
| Works in preview, fails in prod | Env var scope mismatch | Compare env vars across environments |
|
|
238
|
+
| EDGE_FUNCTION_INVOCATION_FAILED | Node.js API in edge runtime | Check imports for Node.js-only modules |
|
|
239
|
+
| Function works locally, fails deployed | Missing dependency or env var | Run `vercel build` locally, check output |
|
|
255
240
|
|
|
256
241
|
## Resources
|
|
257
|
-
|
|
258
|
-
- [Vercel
|
|
242
|
+
|
|
243
|
+
- [Vercel Error Codes](https://vercel.com/docs/errors)
|
|
244
|
+
- [Function Limitations](https://vercel.com/docs/functions/limitations)
|
|
245
|
+
- [Edge Runtime API](https://vercel.com/docs/functions/runtimes/edge)
|
|
246
|
+
- [Vercel Support](https://vercel.com/support)
|
|
247
|
+
- [@vercel/nft](https://github.com/vercel/nft)
|
|
259
248
|
|
|
260
249
|
## Next Steps
|
|
261
|
-
|
|
250
|
+
|
|
251
|
+
For load testing and scaling, see `vercel-load-scale`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Error Handling Reference
|
|
2
|
+
|
|
3
|
+
| Issue | Cause | Solution |
|
|
4
|
+
|-------|-------|----------|
|
|
5
|
+
| Can't reproduce | Race condition | Add timing analysis |
|
|
6
|
+
| Intermittent failure | Timing-dependent | Increase sample size |
|
|
7
|
+
| No useful logs | Missing instrumentation | Add debug logging |
|
|
8
|
+
| Memory growth | Resource leak | Use heap profiling |
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
*[Tons of Skills](https://tonsofskills.com) by [Intent Solutions](https://intentsolutions.io) | [jeremylongshore.com](https://jeremylongshore.com)*
|