stitionai / devika

Devika is an Agentic AI Software Engineer that can understand high-level human instructions, break them down into steps, research relevant information, and write code to achieve the given objective. Devika aims to be a competitive open-source alternative to Devin by Cognition AI.
MIT License
18.13k stars 2.35k forks source link

[ISSUE] failed to connect to server #499

Open danilo139 opened 3 months ago

danilo139 commented 3 months ago

Once i get into de UI it popup a message saying "failed to connect server" and i cant continue, i can not interact in any way with the UI.

image image image

Configuration


- OS: windows 
- Python version: 3.10.6
- Node version: 20.11
ASXXX0 commented 3 months ago

i have the same message with the localhost:3000 but its working good when i lunch with bun run dev --host and take 192.168... try it

with localhost bug

with local ip work

protector131090 commented 3 months ago

same here...

protector131090 commented 3 months ago

i have the same message with the localhost:3000 but its working good when i lunch with bun run dev --host and take 192.168... try it

with localhost bug

with local ip work

same error

Iquryy commented 3 months ago

If you're using anything that would block a connections like portmaster then disable it

protector131090 commented 3 months ago

If you're using anything that would block a connections like portmaster then disable it

i disabled antivirus and windows brandmauer but no help...

danilo139 commented 3 months ago

i have the same message with the localhost:3000 but its working good when i lunch with bun run dev --host and take 192.168... try it

with localhost bug

with local ip work

yeah !! thanks man, finally works with that command line when starting the UI.

If someone has the same issue, just start bun UI with the following line: "bun run dev --host" and then open the IP in your browser

image

cesaregerbino commented 3 months ago

Hi all! I've the same problem. I'm using an Oracle Linux 9.3 virtual machine on Oracle VirtualBox.

Devika backend is up and running .....

image

For the UI if I use bun run start the command output is

image image

and nothing appears in the browser.

If I use bun run dev --host the command output is

image

and the browser still return an empty page

Any suggestion will be appreciated!!

Thank you in advance

ARajgor commented 3 months ago

can you all share the browser's console? also try to run the python server with a different port and update it in api.js and run it again

cesaregerbino commented 3 months ago

Here you are the browser console ... image image To set a different port for the backend, which file should I modify?

TheMaskedAvengers commented 3 months ago

Weirdly I had this working, setup via pinokio, then stopped and restared it and now I'm getting the failed to connect to server error too. the localhost website loads...but when I go to settings all the API keys etc aren't visible there...

thepwnshop commented 3 months ago

I'm having the same issue. It was working, and then all of the sudden, I'm getting this same error.

yuvneesh commented 2 months ago

Hi everyone, late to the party but I had the same issue today when I was trying to set it up. The root cause seems to be the discrepancy between the port on which UI is started and the port used in CORS configuration in devika.py.

I suggest running bun run start before running devika.py. After running bun run start, it will print the local URL with the port number on which the UI is running. Update the CORS call in devika.py to have the same URL in origins as the one given by bun run start.

Both the URLs in the picture should match.

Screenshot 2024-06-09 at 1 40 46 AM Screenshot 2024-06-09 at 1 41 20 AM

I have another thought regarding this: If a port is being used by some other process, bun run start will start on a different port and you will need to update devika.py accordingly. This might explain why @TheMaskedAvengers and @thepwnshop had it working at one point and then it stopped working. However, I wasn't able to test this behaviour. For me bun seems to overtake port 3001 even if another service is using it which is also odd. My expectation was that bun will just start on some other port.

Cheers!

Prakashmaheshwaran commented 2 months ago

@yuvneesh Thank you for the steps, but i have exactly the same image image And still getting the same error image

(It is not working from the start itself)

yuvneesh commented 2 months ago

Try changing https to http in origins

Prakashmaheshwaran commented 2 months ago

Try changing https to http in origins

Tried just now, the issue remains same

Questscape commented 2 months ago

same issue

Questscape commented 2 months ago

I found the fix. Go into Devika.py and change: CORS(app, resources={r"/*": {"origins": ["https://localhost:3000"]}}) to CORS(app)

then start the server with: bun run dev --host

and go to the ip address starting in 192.168...

RuntimeRacer commented 2 months ago

I tried this using docker-compose both on:

Also changed CORS to accept everything.

Same problem. Error Says HTTP 426 Upgrade required :/

UPDATE: I just tried to run it natively on the Ubuntu Server; only mapping ports to my Windows Machine through Putty. Same result. Kinda disappointing.

wjvander commented 2 months ago

I had the same problem. Fixed it thanks to @Questscape.

In your devika.py file, change the origins url to your UI url ie. http://localhost:3001 (for me, no HTTPS but HTTP). After that I started devika up again it solved my Cannot connect to server issue.

Also, it is not needed to run the UI with --host, just use bun run start

jeanny-byte commented 2 months ago

I had this same problem fixed by editing the devika.py file. Make sure the port on which your origin urls is running on is the same port bun starts service. In my case bun run the on port3001while in my devika.py, the port was set to 3000. Change that and run bun run start. you are good to go..

RuntimeRacer commented 2 months ago

All of that didn't work for me. I'm always getting 426 Upgrade Required by the HTTP Requests. As if for some reason it is routing the HTTP calls always to the SocketIO handler, despite the route for SocketIO is defined differently.

But funny that for some people little changes in the CORS URL and port or start command fixed it. For me all of this didn't work. I suspect it might be related to me being on windows.

EnergeticQuanta17 commented 2 months ago

Make sure to change line 29 of devika.py to your frontend URL.

CORS(app, resources={r"/*": {"origins": ["http://localhost:3001"]}}) # Change the origin to your frontend URL

ColumbusAI commented 1 month ago

Make sure to change line 29 of devika.py to your frontend URL.

CORS(app, resources={r"/*": {"origins": ["http://localhost:3001"]}}) # Change the origin to your frontend URL

Can we please get this added to the Readme steps? :-D

sevaroy commented 1 month ago

I had the same problem. Fixed it thanks to @Questscape.

In your devika.py file, change the origins url to your UI url ie. http://localhost:3001 (for me, no HTTPS but HTTP). After that I started devika up again it solved my Cannot connect to server issue.

Also, it is not needed to run the UI with --host, just use bun run start

worked for me

manuhelpiz commented 1 month ago

I've tried everything above and still getting a CONNECTION_TIMED_OUT for 127.0.0.1:1337/api/data

Any other ideas?

Choo-lux commented 2 weeks ago

fail... 127.0.0.1:1337/api/data both docker and venv

sanwacompany commented 4 days ago

I found the fix. Go into Devika.py and change: CORS(app, resources={r"/*": {"origins": ["https://localhost:3000"]}}) to CORS(app)

then start the server with: bun run dev --host

and go to the ip address starting in 192.168...

worked for me.