OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Missing baseUrl in openHands axios instance

Open vinisdl opened this issue 9 months ago • 0 comments

Is there an existing issue for the same bug?

  • [x] I have checked the existing issues.

Describe the bug and reproduction steps

The openHands axios instance in frontend/src/api/open-hands-axios.ts is created without a baseUrl configuration. This can lead to several issues:

  1. Inconsistent API endpoint usage across the application

Current Implementation

export const openHands = axios.create();

Expected Implementation

export const openHands = axios.create({
    baseURL: `http://${import.meta.env.VITE_BACKEND_BASE_URL || window?.location.host}`,
});

Impact

  • Harder to maintain and update API endpoints
  • Increased risk of errors when deploying to different environments
  • Violation of DRY principle by potentially repeating base URLs

OpenHands Installation

Docker command in README

OpenHands Version

main

Operating System

WSL on Windows

Logs, Errors, Screenshots, and Additional Context

  • The missing baseUrl configuration affects all API calls made through the openHands axios instance
  • This is a configuration issue that should be addressed to improve code maintainability
  • Recommended to implement environment-based configuration for the baseUrl

vinisdl avatar Mar 14 '25 21:03 vinisdl