OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Server not Available

Open linxule opened this issue 10 months ago • 14 comments

  1. The commands you ran to start the app
# Backend
conda activate opendevin
uvicorn opendevin.server.listen:app --port 3000

# Frontend
conda activate opendevin
npm start
  1. The environment/config variables you used (redacting your API keys)
MallocNanoZone=0
USER=xulelin
COMMAND_MODE=unix2003
__CFBundleIdentifier=com.microsoft.VSCode
PATH=/Users/xulelin/miniconda3/bin:/Users/xulelin/google-cloud-sdk/bin:/usr/local/bin:/usr/local/bin:/bin:/usr/sbin:/sbin:/usr/bin:/Library/Developer/CommandLineTools/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/opt/homebrew/bin:.
LOGNAME=xulelin
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.mBRPOZ4iaJ/Listeners
HOME=/Users/xulelin
SHELL=/bin/zsh
TMPDIR=/var/folders/93/qllsxfwn1tz2jbj6zt868c780000gn/T/
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
XPC_SERVICE_NAME=0
XPC_FLAGS=0x0
ORIGINAL_XDG_CURRENT_DESKTOP=undefined
SHLVL=1
PWD=/Users/xulelin/Documents/Apps/OpenDevin
OLDPWD=/Users/xulelin/Documents/Apps/OpenDevin
python=python3
OPENAI_API_KEY=XXXXX
CONDA_EXE=/Users/xulelin/miniconda3/bin/conda
_CE_M=
_CE_CONDA=
CONDA_PYTHON_EXE=/Users/xulelin/miniconda3/bin/python
CONDA_SHLVL=1
CONDA_PREFIX=/Users/xulelin/miniconda3
CONDA_DEFAULT_ENV=base
CONDA_PROMPT_MODIFIER=(base) 
TERM_PROGRAM=vscode
TERM_PROGRAM_VERSION=1.87.2
LANG=en_US.UTF-8
COLORTERM=truecolor
GIT_ASKPASS=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh
VSCODE_GIT_ASKPASS_NODE=/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)
VSCODE_GIT_ASKPASS_EXTRA_ARGS=
VSCODE_GIT_ASKPASS_MAIN=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js
VSCODE_GIT_IPC_HANDLE=/var/folders/93/qllsxfwn1tz2jbj6zt868c780000gn/T/vscode-git-17c621477d.sock
VSCODE_INJECTION=1
ZDOTDIR=/Users/xulelin
USER_ZDOTDIR=/Users/xulelin
TERM=xterm-256color
_=/usr/bin/printenv
  1. Everything output from uvicorn after running that command and starting the frontend
INFO:     Will watch for changes in these directories: ['/Users/xulelin/Documents/Apps/OpenDevin']
INFO:     Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit)
INFO:     Started reloader process [21053] using WatchFiles
INFO:     Started server process [21055]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
  1. A screenshot of the /ws item in the network tab of your browser's console (CMD+Shift+C or CTRL+Shift+C ususally) Screenshot20240401 171914@2x

Thank you for time and consideration!

linxule avatar Apr 01 '24 16:04 linxule

Based on the provided information, there doesn't seem to be any issue with starting the backend server using uvicorn. The server is running successfully on http://127.0.0.1:3000, and the application startup has completed without any errors.

However, since you mentioned starting both the backend and frontend, it's possible that there could be an issue with the frontend part (npm start). The output provided here only pertains to the backend server. If you are encountering any issues with the frontend, please provide additional information or error messages related to that part of your application.

@rbren

AbhisekOmkar avatar Apr 01 '24 17:04 AbhisekOmkar

@linxule the 500 errors are suspicious. There should be some logs from uvicorn--can you share those?

rbren avatar Apr 01 '24 17:04 rbren

For Frontend, Error message in the browser is "ERROR: Failed connection to server. Please ensure the server is reachable at ws://localhost:3001/ws."

> [email protected] start
> vite


  VITE v5.2.7  ready in 315 ms

  ➜  Local:   http://localhost:3001/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
6:18:36 PM [vite] ws proxy error:
Error: connect ECONNREFUSED ::1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
6:18:36 PM [vite] http proxy error: /litellm-models
Error: connect ECONNREFUSED ::1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
6:18:36 PM [vite] http proxy error: /litellm-models
Error: connect ECONNREFUSED ::1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) (x2)

For Backend, there seems no be no error:

uvicorn opendevin.server.listen:app --port 3000
INFO:     Started server process [29925]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:3000 (Press CTRL+C to quit)

linxule avatar Apr 01 '24 17:04 linxule

Try adding --host 0.0.0.0 to the uvicorn command

uvicorn opendevin.server.listen:app --port 3000 --host 0.0.0.0

rbren avatar Apr 01 '24 17:04 rbren

Backend works.

(opendevin) xulelin@Xules-MBP14 OpenDevin % uvicorn opendevin.server.listen:app --port 3000 --host 0.0.0.0
INFO:     Started server process [33336]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)

Encountered the same error with frontend.

> [email protected] start
> vite


  VITE v5.2.7  ready in 446 ms

  ➜  Local:   http://localhost:3001/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
6:41:04 PM [vite] ws proxy error:
Error: connect ECONNREFUSED ::1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
6:41:04 PM [vite] http proxy error: /litellm-models
Error: connect ECONNREFUSED ::1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
6:41:04 PM [vite] http proxy error: /litellm-models
Error: connect ECONNREFUSED ::1:3000
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) (x2)

linxule avatar Apr 01 '24 17:04 linxule

I have also enabled Allow the default Docker socket to be used (requires password) on Docker Desktop.

linxule avatar Apr 01 '24 17:04 linxule

I believe I have the same issue. The backend server starts fine at port 3000

The frontend comes up on port 3001, then tries to connect to http://localhost:3001/api/litellm-models and receives a HTTP500. Note the port in that url, ~shouldn't it be connecting to the backend on port 3000, rather than trying to reach a 3001 url?~

The node app proxies http://localhost:3001/api/litellm-models to http://localhost:3000/litellm-models here

foragerr avatar Apr 01 '24 17:04 foragerr

but then the /api path doesn't exist on the backend either..

curl -I http://localhost:3001/api/litellm-models
HTTP/1.1 500 Internal Server Error


curl -I http://localhost:3000/api/litellm-models
HTTP/1.1 404 Not Found


curl http://localhost:3000/litellm-models
["gpt-4","gpt-4-turbo-preview","gpt-4-0314","gpt-4-0613", .... ]

foragerr avatar Apr 01 '24 17:04 foragerr

I tested the endpoint and got

curl -I http://localhost:3001/api/litellm-models
HTTP/1.1 500 Internal Server Error
Access-Control-Allow-Origin: *
Content-Type: text/plain
Date: Mon, 01 Apr 2024 17:57:31 GMT
Connection: keep-alive
Keep-Alive: timeout=5

linxule avatar Apr 01 '24 17:04 linxule

Was working earlier, but did git pull, did npm install for client and pulled the new docker image - now the same problem as above.

odeemi avatar Apr 01 '24 18:04 odeemi

tl;dr: downgrade to node 16 and it works again.

foragerr avatar Apr 01 '24 18:04 foragerr

The issue seems to be related to this change from a few hours ago: https://github.com/OpenDevin/OpenDevin/commit/1ae3f1bf6ad514c2f72858d91164cfcbb3a93fa8

And the cause seems to be this issue: https://github.com/nodejs/node/issues/40537

I don't know the proper fix, but downgrading node to v16 goes around the issue by using localhost instead of [::1] as the backend destination address.

foragerr avatar Apr 01 '24 18:04 foragerr

Alternatively, for node 17+, start your backend with:

uvicorn opendevin.server.listen:app --host '::' --port 3000

foragerr avatar Apr 01 '24 18:04 foragerr

Alternatively, for node 17+, start your backend with:

uvicorn opendevin.server.listen:app --host '::' --port 3000

@foragerr amazing. thank you so much for this!

linxule avatar Apr 01 '24 18:04 linxule

It seems that localhost cannot proxy correctly on node17+. Simply replace it with 127.0.0.1 works. I have opened a pull request: https://github.com/OpenDevin/OpenDevin/pull/535

xcodebuild avatar Apr 02 '24 02:04 xcodebuild