cohere-ai/cohere-toolkit

Backend fails and frontend keeps restarting and NetworkError

da03 opened this issue · 2 comments

da03 commented

What is the issue?

Following the instructions of running from source (using make first-run), backend fails and frontend keeps restarting.

Issue 1

The log in the backend shows:

{"log":"usage: gunicorn [OPTIONS] [APP_MODULE]\r\n","stream":"stdout","time":"2024-06-30T17:46:32.725141827Z"}
{"log":"gunicorn: error: unrecognized arguments: --host 0.0.0.0 --port 8000\r\n","stream":"stdout","time":"2024-06-30T17:46:32.72521952Z"}
{"log":"usage: gunicorn [OPTIONS] [APP_MODULE]\r\n","stream":"stdout","time":"2024-06-30T17:47:26.680371566Z"}
{"log":"gunicorn: error: unrecognized arguments: --host 0.0.0.0 --port 8000\r\n","stream":"stdout","time":"2024-06-30T17:47:26.680407197Z"}

Which seems to be because --host is passed to gunicorn here https://github.com/cohere-ai/cohere-toolkit/blob/main/src/backend/Dockerfile#L54

The frontend log shows:

> @cohere-ai/toolkit-frontend@0.0.0 start
> next start

   ▲ Next.js 14.1.1
   - Local:        http://localhost:3000

Next.js environment variables: {
  NEXT_PUBLIC_API_HOSTNAME: 'http://localhost:8000',
  NEXT_PUBLIC_FRONTEND_HOSTNAME: 'http://localhost:4000',
  NEXT_PUBLIC_HAS_CUSTOM_LOGO: 'false'
}
[Error: ENOENT: no such file or directory, open '/app/.next/BUILD_ID'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/app/.next/BUILD_ID'
}

Issue 2

These issues seem to be caused by @rodrigue-h's most recent commit #ff80f21, so I reverted that commit and now frontend and backend are both running. However, when entering a message (using cohere), there's an error message "NetworkError when attempting to fetch resource".

Issue 3

Now I decide to give up and directly use docker run -e COHERE_API_KEY='my_cohere_api_key' -p 8000:8000 -p 4000:4000 ghcr.io/cohere-ai/cohere-toolkit:latest, but same error message "NetworkError when attempting to fetch resource". When I look at console logs in my browser, it seems to be caused by CORS errors. Not sure if this is related to #106.