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

Front End makes failed request to http://localhost:8000/v1/collections/list #423

Closed
mtutty opened this issue Jan 29, 2025 · 8 comments
Closed

Comments

@mtutty
Copy link

mtutty commented Jan 29, 2025

I've got Cognita running on a VPS server using docker compose. The web application comes up on port 5001 and works in my browser at, e.g., http://cognita-test:5001. I have set VITE_QA_FOUNDRY_URL and OPENAI_API_KEY in compose.env, but not changed any other settings.

However, I'm seeing three failed requests in my Network tab when loading the web app:

http://localhost:8000/v1/collections/list
http://localhost:8000/v1/internal/models?model_type=chat
http://localhost:8000/openapi.json

I can click the "Collections" tab and try to add a collection, but as you might expect, the Model and Data Source fields are empty and unusable.

Browsing to "Data Sources" tab, I also see these failures:
http://localhost:8000/v1/components/dataloaders
http://localhost:8000/v1/data_source/list

Please let me know if I'm missing something - perhaps I skipped chunk of the tutorial?

@mtutty
Copy link
Author

mtutty commented Jan 29, 2025

Update: I found the LOCAL flag in compose.env and set to false. No change. Also tried hard-coding VITE_QA_FOUNDRY_URL in the frontend/Dockerfile.dev file, no change.

@mnvsk97
Copy link
Contributor

mnvsk97 commented Feb 3, 2025

Hello @mtutty
Can you post the config or screenshots of the VPS config?
Also, please post the command that you used to run the app.
Most probably the issue is with configuring the backend URL.

@mtutty
Copy link
Author

mtutty commented Feb 3, 2025

Hi @mnvsk97 Thanks for getting back. Answers:

Can you post the config or screenshots of the VPS config?

VPS is 8 CPU, 16GB RAM, 320GB SSD. Let me know if you need more details there.

Also, please post the command that you used to run the app.
Docker Compose version 2.27.1+ds1-0ubuntu1~24.04.1
docker version 26.1.3

I used docker compose up after copying compose.env to .env, here's the diff of my changes to .env:

root@gforge-ragflow:~/cognita# diff compose.env .env
1c1
< LOCAL=true
---
> LOCAL=false
27c27
< VITE_QA_FOUNDRY_URL=http://localhost:8000
---
> VITE_QA_FOUNDRY_URL=http://gforge-ragflow:8000
29a30
> VITE_USE_RELATIVE_BASE_URL=true
34c35
< OPENAI_API_KEY=
---
> OPENAI_API_KEY=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

Note: The hostname gforge-ragflow is in my local /etc/hosts file. The browser resolves it no problem.

@mnvsk97
Copy link
Contributor

mnvsk97 commented Feb 4, 2025

Got it. Please check if the backend server is reachable from the front-end container.

SSH into front end container: docker exec -it {container_id} sh and then curl to the endpoint to see if it's reachable. If not, you can try changing the backend URL accordingly.

@mtutty
Copy link
Author

mtutty commented Feb 4, 2025

@mnvsk97 curl http://localhost:8000 fails but curl http://cognita-backend:8000 works fine.

I'm not sure how this helps the troubleshooting, though? The failures are from my browser, not between the containers.

Let me know next steps to try.

@mnvsk97
Copy link
Contributor

mnvsk97 commented Feb 5, 2025

Looks like the front end is hitting localhost:8000 instead of the backend container.

potential fix:
1. Update VITE_QA_FOUNDRY_URL in compose.env to http://:8000.
2. Make sure both the front-end and backend are in the same Docker network (docker-compose.yml).
3. Restart services:

docker-compose down && docker-compose up --build

This should fix the communication issue.

If this doesn't help, please join our slack channel and we can hop on a quickcall.

@mtutty
Copy link
Author

mtutty commented Feb 5, 2025

Hi @mnvsk97 Thanks for the update. I tried what you suggested and I get the first front-end page with a spinner that never finishes loading.

I don't think that VITE_QA_FOUNDRY_URL is being used properly by the cognita-frontend container. By way of comparison, if I open a new tab and make the same request that never returns in the UI (but with my hostname), it works fine.

GET http://gforge-ragflow:8000/v1/collections/list => {"collections":[]}

I will check out the Slack channel!

@mtutty
Copy link
Author

mtutty commented Feb 5, 2025

Okay, following up from our video troubleshooting session. I've got it working no problem, so I can move ahead with adding documents and the rest of the POC process.

The key learning here is that the env vars ARE ADDED DURING BUILD TIME, and not at runtime as is more often the case. So if you change the value of VITE_QA_FOUNDRY_URL (i.e., your domain name) then you'll need to rebuild the image for the front end before it takes effect.

@mnvsk97 knew this, but I had to learn it the hard way :)

@mtutty mtutty closed this as completed Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants