reworkd / AgentGPT

πŸ€– Assemble, configure, and deploy autonomous AI Agents in your browser.
https://agentgpt.reworkd.ai
GNU General Public License v3.0
31.92k stars 9.25k forks source link

Error loading tools. #629

Open liferadioat opened 1 year ago

liferadioat commented 1 year ago

Please check that this issue hasn't been reported before.

Expected Behavior

When using docker compose up --build with all .env api credentials the tools should work

Current behaviour

On click at tools button this error occurs: Error loading tools. The database seems to be seeded:

platform  | 2023-05-30 05:57:56.419 | INFO     | logging:callHandlers:1706 - Application startup complete.
next      | Environment variables loaded from .env
next      | Prisma schema loaded from prisma/schema.prisma
next      | Datasource "db": MySQL database "reworkd_platform" at "db:3307"
next      |
next      | πŸš€  Your database is now in sync with your Prisma schema. Done in 144ms
next      |
βœ” Generated Prisma Client (4.13.0 | library) to ./node_modules/@prisma/client in
next      |  299ms
next      |
next      | Environment variables loaded from .env
next      | Prisma schema loaded from prisma/schema.prisma
next      |
next      | βœ” Generated Prisma Client (4.13.0 | library) to ./node_modules/@prisma/client in 296ms
next      | You can now start using Prisma Client in your code. Reference: https://pris.ly/d/client
next      | ```
next      | import { PrismaClient } from '@prisma/client'
next      | const prisma = new PrismaClient()
next      | ```
next      | β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
next      | β”‚  Update available 4.13.0 -> 4.14.1                      β”‚
next      | β”‚  Run the following to update                            β”‚
next      | β”‚    npm i --save-dev prisma@latest                       β”‚
next      | β”‚    npm i @prisma/client@latest                          β”‚
next      | β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
next      |
next      | > agent-gpt@0.5.0 dev
next      | > next dev
next      |
next      | ready - started server on 0.0.0.0:3000, url: http://localhost:3000

Steps to reproduce

git clone nano next/.env -- fill out serp api, openai api etc. like .env.example change platform port at docker-compose.yml to 3500 docker compose up --build

Possible solution

No response

Which Operating Systems are you using?

Acknowledgements

asim-shrestha commented 1 year ago

Hey sorry you're facing this, can you please post your error message here as well?

I think I may have seen your comment on Discord too, can you also make sure you're running the latest changes from main?

liferadioat commented 1 year ago

This is the message, when I open the tools popup:

Select what external tools your agents have access to.

Error loading tools.

2023-05-31_07h34_34

BDAthans commented 1 year ago

Can confirm I am getting the exact same error as @liferadioat

andreyluchianic commented 1 year ago

Same problem here, after Sign In with user from .env Tools are coming back ;)

liferadioat commented 1 year ago

ah OK, iΒ΄ve disabled force_auth at my .env, but signing in locally doesnΒ΄t bring it back at my end. OPENAI_API_BASE="https://api.openai.com/v1" NODE_ENV=development NEXT_PUBLIC_FORCE_AUTH=false

asim-shrestha commented 1 year ago

Everything else works but tools @liferadioat?

Is this with the latest changes from main? Are the requests getting through to the backend?

liferadioat commented 1 year ago

It is since publishing tools from 0.4.0. Everything else seems to work but havenΒ΄t tested all things yet.

liferadioat commented 1 year ago

I think I habe figured out the Problem. I am using ngonx as frontend proxy and I habe no Proxy rule for localhost:8000/api. Have you got any hint?

liferadioat commented 1 year ago

OK IΒ΄ve figured it out. nginx conf: ` location / { proxy_pass http://localhost:3000/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }

    location ^~ /api {
            proxy_pass http://localhost:8000;
            proxy_set_header Host $http_host;
    }

` Tools are working now, but it seems that my own openai key is not recognized, but that is another topic.

jasangill1 commented 1 year ago

Closing due to: solution found & activity, if this error still exists please feel free to reopen this issue @liferadioat @BDAthans @andreyluchianic

iguy0 commented 1 year ago

Hi! I'm still having the issue and the solution pointed out by @liferadioat isn't very clear.

I've tried it this way: git clone cp .env.example .env edit .env mkdir -p ./nginx/conf.d ` cat ./nginx/conf.d/nginx.conf location / { proxy_pass http://localhost:3000/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }

location ^~ /api { proxy_pass http://localhost:8000; proxy_set_header Host $http_host; } ` And changed my docker compose.

Any clues on how to resolve it ?

liferadioat commented 1 year ago

I solved it by two vhosts:

Main application: `server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name xy.cok; ssl_certificate /etc/letsencrypt/live/xy.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/xy.com/privkey.pem;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    add_header Strict-Transport-Security "max-age=63072000; preload";
    add_header X-Frame-Options DENY;
    client_max_body_size    250M;

location / { proxy_pass http://localhost:3000/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } ` Backend vhost:

`server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name backend.xy.com; ssl_certificate /etc/letsencrypt/live/backend.xy.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/backend.xy.com/privkey.pem;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    add_header Strict-Transport-Security "max-age=63072000; preload";
    add_header X-Frame-Options DENY;
    client_max_body_size    250M;

location / { proxy_pass http://localhost:8000/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } `

env config: NEXT_PUBLIC_BACKEND_URL="https://backend.xy.com" NEXTAUTH_URL=https://xy.com

jasangill1 commented 1 year ago

Hello @iguy0 please try @liferadioat solution and let us know if it works, for now, I have reopened this issue.

Looking forward to hearing back from you !!

iguy0 commented 1 year ago

I'm having a hard time testing the solution. This seem like a 2 container setup, so this is what i tried:

services: frontend: image: nginx:alpine container_name: frontend restart: unless-stopped tty: true ports:

with the conf files being: cat ./nginx/conf.d/frontend.conf server { listen 80

listen 443 ssl;

listen [::]:443 ssl;

http2 on;

server_name frontend;

ssl_certificate /etc/letsencrypt/live/xy.com/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/xy.com/privkey.pem;

access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; add_header Strict-Transport-Security "max-age=63072000; preload"; add_header X-Frame-Options DENY; client_max_body_size 250M; location / { proxy_pass http://localhost:3000/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } `

and :

` cat ./nginx/conf.d/backend.conf server { listen 80

listen 443 ssl;

listen [::]:443 ssl;

http2 on;

server_name backend;

ssl_certificate /etc/letsencrypt/live/backend.xy.com/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/backend.xy.com/privkey.pem;

access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; add_header Strict-Transport-Security "max-age=63072000; preload"; add_header X-Frame-Options DENY; client_max_body_size 250M;

location / { proxy_pass http://localhost:8000/; proxy_set_header Host $host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } `

and no dice. I'm accessing this from the same host as the containers.

jasangill1 commented 1 year ago

Please reference this to get a better understanding!!! https://github.com/reworkd/AgentGPT/issues/670

yf007 commented 10 months ago

Has anyone here been able to solve this problem? Apparently, the new version has the same problem.

Tobylamb commented 10 months ago

Have you solved it? I also encountered the same problem on the new version @yf007

Kmfernan5 commented 8 months ago

bump