Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn dev: Error: Must provide a proper URL as target at ProxyServer.<anonymous> #6567

Open
lincolnneu opened this issue Oct 29, 2024 · 6 comments

Comments

@lincolnneu
Copy link

lincolnneu commented Oct 29, 2024

Describe the bug
In yarn dev mode, opening http://localhost:8010/ run into

Error: Must provide a proper URL as target
    at ProxyServer.<anonymous> (/label-studio/web/node_modules/http-proxy/lib/http-proxy/index.js:69:35)
    at HttpProxyMiddleware.middleware (/label-studio/web/node_modules/http-proxy-middleware/dist/http-proxy-middleware.js:22:32)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

To Reproduce
Steps to reproduce the behavior:

  1. Install for local development

Download latest dev branch. Following the READM.md in under web folder https://github.com/HumanSignal/label-studio/blob/0f5a47873a24080f74e3edf50cf3cbee96ef98a0/web/README.md#installation-instructions

yarn install --frozen-lockfile

create the .env (with the same content as .env.development
From the web directory: Run yarn dev and wait till

webpack compiled successfully
  1. Go to http://localhost:8010
  2. The yarn session will show the error msg reported above, and the browser also shows the same error msg.

Expected behavior
yarn dev should result in working frontend session, and http://localhost:8010 should show the label-studio UI

Environment (please complete the following information):

  • Ubuntu 22.04.1 LTS
  • Browser: Chrome
  • Label Studio Version origin/develop e4c2721
@heidi-humansignal
Copy link
Collaborator

heidi-humansignal commented Oct 30, 2024

Hello,

The error you're encountering indicates that the frontend development server's proxy configuration lacks a proper target URL. This usually happens when the backend server is not running or the proxy settings are incorrect.
To resolve this issue, please follow these steps:

Step 1: Start the Backend Server

  1. Navigate to the root directory of Label Studio where manage.py is located.

  2. Start the backend server by running:

    python label_studio/manage.py runserver

By default, this will start the server at http://localhost:8080.

Step 2: Verify the Backend Server is Running

  • Open your browser and navigate to http://localhost:8080 to confirm that the backend server is running.

Step 3: Check Frontend Proxy Configuration

  1. In the web directory, ensure you have a .env file. If not, create one and copy the contents from .env.development.

  2. Open the .env file and verify that the VITE_BACKEND_HOST variable is set correctly:

    VITE_BACKEND_HOST=http://localhost:8080
    Adjust the host and port if your backend server is running on a different address.

Thank you,
Abu

Comment by Abubakar Saad
Workflow Run

@lincolnneu
Copy link
Author

Hello,

The error you're encountering indicates that the frontend development server's proxy configuration lacks a proper target URL. This usually happens when the backend server is not running or the proxy settings are incorrect. To resolve this issue, please follow these steps:

Step 1: Start the Backend Server

  1. Navigate to the root directory of Label Studio where manage.py is located.
  2. Start the backend server by running:
    python label_studio/manage.py runserver

By default, this will start the server at http://localhost:8080.

Step 2: Verify the Backend Server is Running

  • Open your browser and navigate to http://localhost:8080 to confirm that the backend server is running.

Step 3: Check Frontend Proxy Configuration

  1. In the web directory, ensure you have a .env file. If not, create one and copy the contents from .env.development.
  2. Open the .env file and verify that the VITE_BACKEND_HOST variable is set correctly:
    VITE_BACKEND_HOST=http://localhost:8080
    Adjust the host and port if your backend server is running on a different address.

Thank you, Abu

Comment by Abubakar Saad
Workflow Run

Hi, I followed your instruction and added VITE_BACKEND_HOST=http://localhost:8080 under /web/.env and still get the same errors.

I can confirm that the drango backend is running as the UI shows up when visiting http://localhost:8080. However, when visiting the frontend http://localhost:8010, it shows the error mentioned in this issue.

I also tried running the django backend and yarn dev from a mac, and get the same errors.

@WangCheng0928
Copy link

so, how do you solve this? I have the same question~ thanks!

@ArthurAlesi
Copy link

having the same issue. even on windows or linux (wsl)

@max82645235
Copy link

having the same issue in mac . Error: Must provide a proper URL as target

@faleandroid
Copy link

I'm having the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants