Skip to content

[Bug] Blast Radius API Function Uses Wrong Environment Variable — Silent Feature Breakage #321

Description

@ionfwsrijan

Description

The getOrgBlastRadius function references VITE_API_URL instead of VITE_API_BASE_URL, causing silent fetch failures in any non-default deployment. Every other API function uses the centralized API_BASE constant, but this one function hardcodes a different env var name that is never set anywhere.

Actual Behavior

Every other API function uses API_BASE:
frontend/src/app/lib/api.ts (lines 1-3):

export const API_BASE =
  import.meta.env.VITE_API_BASE_URL?.replace(/\/$/, "") ||
  "http://localhost:8000";

Blast radius uses wrong env var:
frontend/src/app/lib/api.ts (lines 352-360):

export async function getOrgBlastRadius(orgJobId: string) {
  const baseUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000';  // ← WRONG VAR
  const response = await fetch(`${baseUrl}/api/scans/org/${orgJobId}/blast-radius`);
  // ...
}

.env only defines the correct var:

VITE_API_BASE_URL=http://localhost:8000

VITE_API_URL is never defined anywhere in the codebase.

The blast radius graph component calls this function:
frontend/src/app/components/blast-radius-graph.tsx (lines 78-79):

const data = await getOrgBlastRadius(orgJobId);  // ← silently fails in production

Impact

  • In any deployment behind a reverse proxy, Docker network, or custom port, the blast radius graph silently breaks
  • The feature shows "Failed to load dependency graph" with no indication of why it fails while all other features work
  • A key differentiating feature of the org scan workflow is non-functional in production

Expected Behavior

All API functions must use the same centralized API_BASE constant for consistent behavior across deployments.

Proposed Fix

  1. api.ts: Change getOrgBlastRadius to use API_BASE instead of import.meta.env.VITE_API_URL
  2. Remove the dead VITE_API_URL reference entirely
  3. Verify no other functions have similar env var mismatches

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions