Env vars updated
This commit is contained in:
@@ -12,18 +12,6 @@ import Anthropic from '@anthropic-ai/sdk'
|
|||||||
* synchronous execution limit.
|
* synchronous execution limit.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Managed Agent configuration
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// The Managed Agent ID and Environment ID come from the Claude Console.
|
|
||||||
// Optionally, vault IDs may be passed for MCP credential access.
|
|
||||||
const AGENT_ID = process.env.ANTHROPIC_AGENT_ID
|
|
||||||
const ENVIRONMENT_ID = process.env.ANTHROPIC_ENVIRONMENT_ID
|
|
||||||
const VAULT_IDS = (process.env.ANTHROPIC_VAULT_IDS || '')
|
|
||||||
.split(',')
|
|
||||||
.map((s) => s.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
|
|
||||||
// All Managed Agents endpoints require this beta header.
|
// All Managed Agents endpoints require this beta header.
|
||||||
const MANAGED_AGENTS_BETA = 'managed-agents-2026-04-01'
|
const MANAGED_AGENTS_BETA = 'managed-agents-2026-04-01'
|
||||||
|
|
||||||
@@ -71,11 +59,21 @@ export default async (req /*, context */) => {
|
|||||||
return new Response('Invalid station website URL', { status: 400 })
|
return new Response('Invalid station website URL', { status: 400 })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AGENT_ID || !ENVIRONMENT_ID) {
|
// Read env vars at request time (Netlify makes them available per-invocation).
|
||||||
return new Response(
|
const AGENT_ID = process.env.ANTHROPIC_AGENT_ID
|
||||||
'Server is missing ANTHROPIC_AGENT_ID or ANTHROPIC_ENVIRONMENT_ID',
|
const ENVIRONMENT_ID = process.env.ANTHROPIC_ENVIRONMENT_ID
|
||||||
{ status: 500 },
|
const VAULT_IDS = (process.env.ANTHROPIC_VAULT_IDS || '')
|
||||||
)
|
.split(',')
|
||||||
|
.map((s) => s.trim())
|
||||||
|
.filter(Boolean)
|
||||||
|
|
||||||
|
const missing = []
|
||||||
|
if (!AGENT_ID) missing.push('ANTHROPIC_AGENT_ID')
|
||||||
|
if (!ENVIRONMENT_ID) missing.push('ANTHROPIC_ENVIRONMENT_ID')
|
||||||
|
if (missing.length) {
|
||||||
|
return new Response(`Server is missing env var(s): ${missing.join(', ')}`, {
|
||||||
|
status: 500,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let client
|
let client
|
||||||
|
|||||||
Reference in New Issue
Block a user