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

Server not Available #508

Closed
linxule opened this issue Apr 1, 2024 · 15 comments · Fixed by #534 or #535
Closed

Server not Available #508

linxule opened this issue Apr 1, 2024 · 15 comments · Fixed by #534 or #535
Assignees
Labels
bug Something isn't working

Comments

@linxule
Copy link

linxule commented Apr 1, 2024

  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 linxule added the bug Something isn't working label Apr 1, 2024
@AbhisekOmkar
Copy link
Contributor

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

@rbren
Copy link
Collaborator

rbren commented Apr 1, 2024

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

@linxule
Copy link
Author

linxule commented Apr 1, 2024

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

> opendevin-frontend@0.1.0 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)

@rbren
Copy link
Collaborator

rbren commented Apr 1, 2024

Try adding --host 0.0.0.0 to the uvicorn command

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

@linxule
Copy link
Author

linxule commented Apr 1, 2024

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.

> opendevin-frontend@0.1.0 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
Copy link
Author

linxule commented Apr 1, 2024

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

@foragerr
Copy link
Collaborator

foragerr commented Apr 1, 2024

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
Copy link
Collaborator

foragerr commented Apr 1, 2024

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", .... ]

@linxule
Copy link
Author

linxule commented Apr 1, 2024

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

@odeemi
Copy link

odeemi commented Apr 1, 2024

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

@foragerr
Copy link
Collaborator

foragerr commented Apr 1, 2024

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

@foragerr
Copy link
Collaborator

foragerr commented Apr 1, 2024

The issue seems to be related to this change from a few hours ago: 1ae3f1b

And the cause seems to be this issue: nodejs/node#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
Copy link
Collaborator

foragerr commented Apr 1, 2024

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

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

@linxule
Copy link
Author

linxule commented Apr 1, 2024

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

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

@foragerr amazing. thank you so much for this!

@xcodebuild
Copy link
Contributor

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

@rbren rbren closed this as completed in #534 Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
7 participants