Skip to main content
Applies to:


Summary

Issue: Streaming logs fails with initialization errors or Forbidden errors when both apiUrl and appUrl are set with conflicting values (e.g., staging URL in global env and production URL in app config). Cause: apiUrl takes precedence over appUrl, causing SDK requests to go to the wrong data plane endpoint. Resolution: Remove conflicting URL configurations and set only BRAINTRUST_API_URL or apiUrl to point to your data plane endpoint.

Resolution Steps

If using standard Braintrust hosted deployment

Step 1: Remove appUrl configuration

Only set appUrl if your frontend is hosted somewhere other than https://www.braintrust.dev.
const logger = initLogger({
    projectId: braintrustProjectId,
    projectName: braintrustProjectName,
    apiKey: braintrustApiKey
    // Remove appUrl unless custom frontend
})

Step 2: Verify API URL is not set in global environment

Check that BRAINTRUST_API_URL or apiUrl is not set in global environment variables with incorrect values.

If using self-hosted or hybrid deployment

Step 1: Set only apiUrl to data plane endpoint

Configure BRAINTRUST_API_URL or apiUrl to point to your data plane, not the web app URL.
const logger = initLogger({
    projectId: braintrustProjectId,
    projectName: braintrustProjectName,
    apiKey: braintrustApiKey,
    apiUrl: 'https://your-data-plane-url.com'  // Not appUrl
})

Step 2: Verify data plane URL in settings

Navigate to Settings > Data Plane in the Braintrust UI to confirm the correct endpoint.

Step 3: Remove conflicting appUrl configurations

Check both global environment variables and application-level configs for conflicting appUrl settings.

Additional Information

URL configuration differences

  • BRAINTRUST_API_URL / apiUrl: Data plane endpoint where SDK makes logging requests (required for self-hosted)
  • appUrl: Web app URL for authentication and link generation (only needed if frontend is not at braintrust.dev)
  • When both are set, apiUrl takes precedence

Common configuration mistakes

  • Setting API_URL in global environment with staging URL while passing production appUrl from application
  • Using appUrl instead of apiUrl for data plane configuration
  • Not checking Settings > Data Plane for correct endpoint in self-hosted deployments