Add PAT login
This commit is contained in:
@@ -16,11 +16,23 @@ npm install
|
||||
```
|
||||
|
||||
2. **Add `.env.local`**
|
||||
|
||||
```env
|
||||
# Required
|
||||
VERCEL_TEAM_ID=your_team_id # Your Vercel team ID for sandbox access
|
||||
FIRECRAWL_API_KEY=your_firecrawl_api_key # Get from https://firecrawl.dev (Web scraping)
|
||||
|
||||
# Vercel Sandbox Authentication (choose one method)
|
||||
# See: https://vercel.com/docs/vercel-sandbox#authentication
|
||||
|
||||
# Method 1: OIDC Token (recommended for development)
|
||||
# Run `vercel link` then `vercel env pull` to get VERCEL_OIDC_TOKEN automatically
|
||||
# VERCEL_OIDC_TOKEN=auto_generated_by_vercel_env_pull
|
||||
|
||||
# Method 2: Personal Access Token (for production or when OIDC unavailable)
|
||||
# VERCEL_TEAM_ID=team_xxxxxxxxx # Your Vercel team ID
|
||||
# VERCEL_PROJECT_ID=prj_xxxxxxxxx # Your Vercel project ID
|
||||
# VERCEL_TOKEN=vercel_xxxxxxxxxxxx # Personal access token from Vercel dashboard
|
||||
|
||||
# Optional (need at least one AI provider)
|
||||
ANTHROPIC_API_KEY=your_anthropic_api_key # Get from https://console.anthropic.com
|
||||
OPENAI_API_KEY=your_openai_api_key # Get from https://platform.openai.com (GPT-5)
|
||||
|
||||
@@ -35,13 +35,29 @@ export async function POST() {
|
||||
global.existingFiles = new Set<string>();
|
||||
}
|
||||
|
||||
// Create Vercel sandbox
|
||||
// Create Vercel sandbox with flexible authentication
|
||||
console.log(`[create-ai-sandbox] Creating Vercel sandbox with ${appConfig.vercelSandbox.timeoutMinutes} minute timeout...`);
|
||||
sandbox = await Sandbox.create({
|
||||
|
||||
// Prepare sandbox configuration
|
||||
const sandboxConfig: any = {
|
||||
timeout: appConfig.vercelSandbox.timeoutMs,
|
||||
runtime: appConfig.vercelSandbox.runtime,
|
||||
ports: [appConfig.vercelSandbox.devPort]
|
||||
});
|
||||
};
|
||||
|
||||
// Add authentication parameters if using personal access token
|
||||
if (process.env.VERCEL_TOKEN && process.env.VERCEL_TEAM_ID && process.env.VERCEL_PROJECT_ID) {
|
||||
console.log('[create-ai-sandbox] Using personal access token authentication');
|
||||
sandboxConfig.teamId = process.env.VERCEL_TEAM_ID;
|
||||
sandboxConfig.projectId = process.env.VERCEL_PROJECT_ID;
|
||||
sandboxConfig.token = process.env.VERCEL_TOKEN;
|
||||
} else if (process.env.VERCEL_OIDC_TOKEN) {
|
||||
console.log('[create-ai-sandbox] Using OIDC token authentication');
|
||||
} else {
|
||||
console.log('[create-ai-sandbox] No authentication found - relying on default Vercel authentication');
|
||||
}
|
||||
|
||||
sandbox = await Sandbox.create(sandboxConfig);
|
||||
|
||||
const sandboxId = sandbox.sandboxId;
|
||||
console.log(`[create-ai-sandbox] Sandbox created: ${sandboxId}`);
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
# Required
|
||||
FIRECRAWL_API_KEY=your_firecrawl_api_key # Get from https://firecrawl.dev (Web scraping)
|
||||
|
||||
# Vercel Sandbox Authentication (choose one method)
|
||||
# See: https://vercel.com/docs/vercel-sandbox#authentication
|
||||
|
||||
# Method 1: OIDC Token (recommended for development)
|
||||
# Run `vercel env pull` to get VERCEL_OIDC_TOKEN automatically
|
||||
# VERCEL_OIDC_TOKEN=auto_generated_by_vercel_env_pull
|
||||
|
||||
# Method 2: Personal Access Token (for production or when OIDC unavailable)
|
||||
# Get these values from your Vercel dashboard
|
||||
# VERCEL_TEAM_ID=team_xxxxxxxxx
|
||||
# VERCEL_PROJECT_ID=prj_xxxxxxxxx
|
||||
# VERCEL_TOKEN=vercel_xxxxxxxxxxxx
|
||||
|
||||
# Optional AI providers (need at least one)
|
||||
ANTHROPIC_API_KEY=your_anthropic_api_key # Get from https://console.anthropic.com
|
||||
OPENAI_API_KEY=your_openai_api_key # Get from https://platform.openai.com (GPT-5)
|
||||
GEMINI_API_KEY=your_gemini_api_key # Get from https://aistudio.google.com/app/apikey
|
||||
GROQ_API_KEY=your_groq_api_key # Get from https://console.groq.com (Fast inference)
|
||||
Reference in New Issue
Block a user