devika: [ISSUE] failed to connect to server

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


About this issue

Most upvoted comments

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…

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!

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

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.

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

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

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

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

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

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