OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Frontend Server: 404 Error for API Endpoints and Token Validation Issues

Open wassmi opened this issue 1 year ago • 1 comments

Is there an existing issue for the same bug?

  • [X] I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
  • [X] I have checked the existing issues.

Describe the bug

Issue Summary:

When running the frontend application using npm start, the server starts successfully and provides access to the application at http://localhost:3001/. However, when attempting to access the /api/options/models endpoint and establish WebSocket connections, the server returns a "Not Found" error (404). Additionally, there are errors related to token validation and decoding in the logs.

Steps to Reproduce:

Start the frontend server using npm start. Attempt to access the application at http://localhost:3001/. Attempt to access the /api/options/models endpoint using curl or a web browser. Attempt to establish WebSocket connections to the server. Expected Behavior:

Accessing the application at http://localhost:3001/ should display the frontend interface. Accessing the /api/options/models endpoint should return a list of available models. WebSocket connections should be established successfully without errors related to token validation or decoding. Actual Behavior:

Accessing the application at http://localhost:3001/ displays the frontend interface as expected. Accessing the /api/options/models endpoint returns a "Not Found" error (404). WebSocket connections are accepted, but errors related to token validation and decoding are logged. On the UI. it says "Initializing agent (may take up to 10 seconds)..." but is stuck on that. Additional Information:

Server logs indicate errors related to token validation and decoding.

INFO: IP:51964 - "GET /api/options/models HTTP/1.1" 404 Not Found INFO: IP:32133 - "GET /api/options/models HTTP/1.1" 404 Not Found INFO: ('IP', 38303) - "WebSocket /ws?token=" [accepted] 16:59:14 - opendevin:ERROR: auth.py:32 - Invalid token 16:59:14 - opendevin:ERROR: listen.py:45 - Failed to decode token

The frontend server is started using npm start.

Steps Taken to Resolve: Screen Shot 2024-05-23 at 1 10 15 PM

Checked the route definitions in the frontend server code to ensure they match the requested URLs. Verified that the frontend server is running and no errors are encountered during startup. Inspected the code related to token validation and decoding for any issues.

Current Version

ghcr.io/opendevin/opendevin:0.5

Installation and Configuration

docker run \
    -it \
    --pull=always \
    -e SANDBOX_USER_ID=$(id -u) \
    -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
    -v $WORKSPACE_BASE:/opt/workspace_base \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -p 3000:3000 \
    --add-host host.docker.internal:host-gateway \
    ghcr.io/opendevin/opendevin:0.5

Model and Agent

No response

Reproduction Steps

No response

Logs, Errors, Screenshots, and Additional Context

Screen Shot 2024-05-23 at 1 10 15 PM

wassmi avatar May 23 '24 17:05 wassmi

start the backend too

SmartManoj avatar May 24 '24 08:05 SmartManoj

I started the backend too of course…

wassmi avatar May 24 '24 21:05 wassmi

Does the same happen if you open http://localhost:3000?

SmartManoj avatar May 25 '24 05:05 SmartManoj

Run the application at http://localhost:3000/ to resolve your problem. I had the same experience and this approach worked for me. @wassmi

Thanks @SmartManoj for the solution!

ming0627 avatar May 26 '24 05:05 ming0627

It wasn't working even on http://localhost:3000/ up until today. Now it works. Thanks a lot for the help guys!

wassmi avatar May 29 '24 00:05 wassmi