openchatai / OpenCopilot

🤖 🔥 Language-to-actions engine

Home Page:https://opencopilot.so

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error creating a new copilot

WKaiH123 opened this issue · comments

Describe the bug
I can't create a new copilot.
image

Can you run make logs and share the error that happens when you try to create a copilot?

When I try to create a new copilot, I get the following error:
image

Can you try to run make restart? and then give it another try?

I encountered a similar issue, looking into it

2023-12-19 17:46:54     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
2023-12-19 17:46:54   File "/app/routes/copilot/copilot_controller.py", line 41, in create_new_copilot
2023-12-19 17:46:54     user = get_user_by_email(get_username_from_request(request))

I have this same error:
Screenshot 2023-12-20 at 12 30 06

At the same time the above is happening, the logs are outputting these lines:

llm-server_1  | 192.168.80.8 - - [20/Dec/2023 02:30:06] "GET /healthcheck HTTP/1.1" 200 -
llm-server_1  | 192.168.80.8 - - [20/Dec/2023 02:30:17] "GET /healthcheck HTTP/1.1" 200 -
llm-server_1  | 192.168.80.8 - - [20/Dec/2023 02:30:27] "GET /healthcheck HTTP/1.1" 200 -
llm-server_1  | 192.168.80.8 - - [20/Dec/2023 02:30:37] "GET /healthcheck HTTP/1.1" 200 -

It seems it is an error trying to contact localhost.

POST http://localhost:8888/backend/copilot/ net::ERR_CONNECTION_REFUSED

GET http://localhost:8888/backend/copilot/ net::ERR_CONNECTION_REFUSED

In my case, while I am running a developer/local version, I am doing so on a server. The client (a laptop) I am using to access the server is trying to connect to the localhost (laptop).

If I make the GET request to the server, then I get a proper result [] (instead of the ERR_CONNECTION_REFUSED):

$ curl -i http://my-open-chat-ai-server:8888/backend/copilot
HTTP/1.1 200 OK
Server: nginx/1.25.3

Content-Type: application/json
Content-Length: 3
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: *
Access-Control-Allow-Headers: *
Access-Control-Expose-Headers: Content-Length,Content-Range

[]

Can you please let me know what command I need to restart nginx once?
Thanks so much.

$ docker compose restart nginx
WARN[0000] The "TARGET" variable is not set. Defaulting to a blank string. 
[+] Restarting 1/1
 ✔ Container opencopilot_nginx_1  Started             

Still the same error, but this is a new message in the logs:

dashboard_1   |  ⨯ Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly. Read more at: https://nextjs.org/docs/messages/sharp-missing-in-production

  • "The client (a laptop) I am using to access the server is trying to connect to the localhost (laptop)."
    If i undertand correctly, you use the ip of the server and not localhost, when calling the api on the server ?

Also @ah7255703 can you check the issue with sharp?

Yes, interacting with the ip of the server (not localhost). However, the browser's console is outputting errors relating to contacting localhost with requests using the GET and POST verbs:
Screenshot 2023-12-20 at 14 22 26

I went ahead and updated vi ./dashboard/data/base-url.ts from:

export const baseUrl = 'http://localhost:8888'

to

export const baseUrl = 'http://my-open-chat-ai-server:8888'

The error in the console of my browser has been resolved.

@tpmccallum Hi, after I modified the base-url.ts file, I still didn't solve the problem. How did you solve it?

Problem solved, thank you very much!