Open lincolnneu opened 1 month ago
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:
manage.py
is located.Start the backend server by running:
python label_studio/manage.py runserver
By default, this will start the server at http://localhost:8080
.
http://localhost:8080
to confirm that the backend server is running.web
directory, ensure you have a .env
file. If not, create one and copy the contents from .env.development
.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
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
- Navigate to the root directory of Label Studio where
manage.py
is located.- 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
- In the
web
directory, ensure you have a.env
file. If not, create one and copy the contents from.env.development
.- Open the
.env
file and verify that theVITE_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.
so, how do you solve this? I have the same question~ thanks!
having the same issue. even on windows or linux (wsl)
having the same issue in mac . Error: Must provide a proper URL as target
I'm having the same issue.
Any update on this? I have the same problem
I solved the problem by updating the devServer.proxy option in the webpack.config.js file like this:
{
host: "127.0.0.1",
// Port for the Webpack dev server
port: HMR_PORT,
// Enable HMR
hot: true,
// Allow cross-origin requests from Django
headers: { "Access-Control-Allow-Origin": "*" },
static: {
directory: path.resolve(__dirname, "../label_studio/core/static/"),
publicPath: "/static",
},
devMiddleware: {
publicPath: ${FRONTEND_HOSTNAME}/react-app/
,
},
allowedHosts: "all", // Allow access from Django's server
proxy: {
'/api': {
target: ${DJANGO_HOSTNAME}/api
,
changeOrigin: true,
pathRewrite: { '^/api': '' },
secure: false,
},
'/': {
target: ${DJANGO_HOSTNAME}
,
changeOrigin: true,
secure: false,
}
},
}
thanks, it works!
Please try out max82645235 solution and if there are still issues, please let us know. We will try to simplify this.
Thank you, Abu
Comment by Abubakar Saad Workflow Run
proxy: [
// {
// router: {
// "/api": `${DJANGO_HOSTNAME}/api`, // Proxy api requests to Django's server
// },
// },
{
context: ["/api"],
target: `${DJANGO_HOSTNAME}`,
secure: false,
changeOrigin: true,
logLevel: "debug",
}
],
Describe the bug In
yarn dev
mode, openinghttp://localhost:8010/
run intoTo Reproduce Steps to reproduce the behavior:
Download latest dev branch. Following the READM.md in under
web
folder https://github.com/HumanSignal/label-studio/blob/0f5a47873a24080f74e3edf50cf3cbee96ef98a0/web/README.md#installation-instructionscreate the .env (with the same content as .env.development From the
web
directory: Runyarn dev
and wait tillExpected behavior yarn dev should result in working frontend session, and
http://localhost:8010
should show the label-studio UIEnvironment (please complete the following information):