Skip to content
This repository was archived by the owner on Mar 25, 2026. It is now read-only.

Commit 77b7070

Browse files
fix: set default AGENT_BASE_URL to production doc-agents URL (#345)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: srith@agentuity.com <rithsenghorn@gmail.com>
1 parent 217f3d3 commit 77b7070

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/config.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
* Contains non-secret configuration values
44
*/
55

6+
const DEFAULT_AGENT_BASE_URL = 'https://p0f83a312791b60ff.agentuity.run';
7+
68
export const config = {
79
kvStoreName: 'docs-sandbox-chat-sessions',
8-
// V1 Agent endpoints - must be set via AGENT_BASE_URL env var
9-
agentBaseUrl: process.env.AGENT_BASE_URL,
10+
// V1 Agent endpoints - defaults to production doc-agents URL
11+
agentBaseUrl: process.env.AGENT_BASE_URL || DEFAULT_AGENT_BASE_URL,
1012
agentuityRegion: 'use',
1113
} as const;

middleware.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ const TYPE_MAP: Record<string, string> = {
1515
const COOKIE_NAME = 'chat_user_id';
1616
const COOKIE_MAX_AGE = 24 * 60 * 60 * 14; // 14 days
1717

18-
// Agentuity backend config (no fallbacks - must be set explicitly)
19-
const AGENT_BASE_URL = process.env.AGENT_BASE_URL;
18+
// Agentuity backend config
19+
const DEFAULT_AGENT_BASE_URL = 'https://p0f83a312791b60ff.agentuity.run';
20+
const AGENT_BASE_URL = process.env.AGENT_BASE_URL || DEFAULT_AGENT_BASE_URL;
2021
const AGENT_BEARER_TOKEN = process.env.AGENT_BEARER_TOKEN;
2122

2223
export function middleware(request: NextRequest) {
@@ -31,14 +32,11 @@ export function middleware(request: NextRequest) {
3132

3233
// Proxy API requests to Agentuity backend with bearer token
3334
if (pathname.startsWith('/api/sessions') || pathname === '/api/agent_pulse' || pathname === '/api/doc-qa') {
34-
const missingVars = [];
35-
if (!AGENT_BASE_URL) missingVars.push('AGENT_BASE_URL');
36-
if (!AGENT_BEARER_TOKEN) missingVars.push('AGENT_BEARER_TOKEN');
37-
38-
if (missingVars.length > 0) {
39-
console.error(`[middleware] Missing required env vars: ${missingVars.join(', ')}`);
35+
// AGENT_BEARER_TOKEN is required for authenticated endpoints
36+
if (!AGENT_BEARER_TOKEN) {
37+
console.error('[middleware] Missing required env var: AGENT_BEARER_TOKEN');
4038
return NextResponse.json(
41-
{ error: `Server misconfigured: missing ${missingVars.join(', ')}` },
39+
{ error: 'Server misconfigured: missing AGENT_BEARER_TOKEN' },
4240
{ status: 503 }
4341
);
4442
}

0 commit comments

Comments
 (0)