vercel
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVercel Deployment Guide
Vercel 部署指南
Deployment Protection and Agent Access
部署保护与Agent访问
Vercel deployments may have Deployment Protection enabled, which requires authentication to access preview deployments. This can block automated testing and agent access to preview URLs.
Vercel部署可能已启用Deployment Protection,这会要求用户进行身份验证才能访问预览部署。这可能会阻止自动化测试和Agent访问预览URL。
Identifying Protected Deployments
识别受保护的部署
If you encounter a login page or authentication requirement when accessing a Vercel preview URL, the deployment has protection enabled. Signs include:
- Redirect to or SSO login page
vercel.com/login - 401/403 errors when accessing the deployment
- Preview URLs that require Vercel team membership
如果访问Vercel预览URL时遇到登录页面或身份验证要求,则说明该部署已启用保护。迹象包括:
- 重定向至或SSO登录页面
vercel.com/login - 访问部署时出现401/403错误
- 要求具备Vercel团队成员身份的预览URL
Enabling Agent Access with Protection Bypass
通过保护绕过功能启用Agent访问
To allow agents and automated systems to access protected deployments, users need to set up Protection Bypass for Automation:
-
Navigate to Project Settings
- Go to the Vercel Dashboard
- Select the project
- Click on Settings → Deployment Protection
-
Generate a Protection Bypass Secret
- Under "Protection Bypass for Automation", click Generate Secret
- Copy the generated secret securely
-
Using the Bypass SecretThe secret can be used in two ways:As a Header:bash
curl -H "x-vercel-protection-bypass: <secret>" https://your-preview-url.vercel.appAs a Query Parameter:https://your-preview-url.vercel.app?x-vercel-protection-bypass=<secret> -
For Browser-Based Testing
- Append to the preview URL
?x-vercel-protection-bypass=<secret> - The secret will be stored in a cookie for subsequent requests
- Append
要允许Agent和自动化系统访问受保护的部署,用户需要设置Protection Bypass for Automation:
-
导航至项目设置
- 进入Vercel控制台
- 选择对应的项目
- 点击设置 → 部署保护
-
生成保护绕过密钥
- 在"Protection Bypass for Automation"下,点击Generate Secret
- 安全地复制生成的密钥
-
使用绕过密钥密钥有两种使用方式:作为请求头:bash
curl -H "x-vercel-protection-bypass: <secret>" https://your-preview-url.vercel.app作为查询参数:https://your-preview-url.vercel.app?x-vercel-protection-bypass=<secret> -
基于浏览器的测试
- 追加到预览URL末尾
?x-vercel-protection-bypass=<secret> - 密钥将存储在Cookie中,用于后续请求
- 追加
Alternative: Disable Protection for Previews
替代方案:禁用预览部署的保护
If protection bypass is not suitable, users can disable protection for preview deployments:
- Go to Settings → Deployment Protection
- Set "Vercel Authentication" to Only Production Deployments or Disabled
Do NOT repeatedly attempt to access protected URLs without the bypass secret.
</IMPORTANT>
如果保护绕过功能不适用,用户可以禁用预览部署的保护:
- 进入设置 → 部署保护
- 将"Vercel Authentication"设置为仅生产部署或已禁用
请勿在没有绕过密钥的情况下反复尝试访问受保护的URL。
</IMPORTANT>
Environment Variables
环境变量
Set environment variables in Vercel Dashboard under Settings → Environment Variables, or use the Vercel CLI:
bash
vercel env add MY_SECRETAccess in your application:
typescript
const secret = process.env.MY_SECRET;在Vercel控制台的设置 → 环境变量中设置环境变量,或使用Vercel CLI:
bash
vercel env add MY_SECRET在应用中访问:
typescript
const secret = process.env.MY_SECRET;Vercel CLI Commands
Vercel CLI 命令
Common Vercel CLI commands:
bash
undefined常用的Vercel CLI命令:
bash
undefinedLogin to Vercel
登录Vercel
vercel login
vercel login
Deploy to preview
部署到预览环境
vercel
vercel
Deploy to production
部署到生产环境
vercel --prod
vercel --prod
List deployments
列出所有部署
vercel ls
vercel ls
View deployment logs
查看部署日志
vercel logs <deployment-url>
vercel logs <deployment-url>
Pull environment variables locally
拉取环境变量到本地
vercel env pull
undefinedvercel env pull
undefined