TransformerOptimus / SuperAGI

<⚡️> SuperAGI - A dev-first open source autonomous AI agent framework. Enabling developers to build, manage & run useful autonomous agents quickly and reliably.
https://superagi.com/
MIT License
15.22k stars 1.83k forks source link

404 and Connection Refused #307

Closed bitnom closed 11 months ago

bitnom commented 1 year ago

Attempting to load in the browser shows connection errors. The software returns a 404 page

GET http://192.168.0.247:3000/ 404 (Not Found) which displays this:

image

In the browser console I also have:

Error fetching project: AxiosError {message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK', config: {…}, request: XMLHttpRequest, …}        client.js

http://192.168.0.247:8001/configs/get/env net::ERR_CONNECTION_REFUSED

Websocket.js:65 WebSocket connection to 'ws://192.168.0.247:3000/_next/webpack-hmr' failed: WebSocket is closed before the connection is established.

and here's the docker log:

[+] Building 4.7s (32/32) FINISHED                                                                                                                                                                                                                                                                                  
 => [gui internal] load build definition from Dockerfile                                                                                                                                                                                                                                                       0.1s
 => => transferring dockerfile: 140B                                                                                                                                                                                                                                                                           0.0s
 => [gui internal] load .dockerignore                                                                                                                                                                                                                                                                          0.1s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                0.0s
 => [backend internal] load build definition from Dockerfile                                                                                                                                                                                                                                                   0.2s
 => => transferring dockerfile: 377B                                                                                                                                                                                                                                                                           0.0s
 => [backend internal] load .dockerignore                                                                                                                                                                                                                                                                      0.2s
 => => transferring context: 50B                                                                                                                                                                                                                                                                               0.0s
 => [celery internal] load build definition from DockerfileCelery                                                                                                                                                                                                                                              0.3s
 => => transferring dockerfile: 249B                                                                                                                                                                                                                                                                           0.0s
 => [celery internal] load .dockerignore                                                                                                                                                                                                                                                                       0.3s
 => => transferring context: 50B                                                                                                                                                                                                                                                                               0.0s
 => [gui internal] load metadata for docker.io/library/node:lts                                                                                                                                                                                                                                                1.4s
 => [celery internal] load metadata for docker.io/library/python:3.9                                                                                                                                                                                                                                           1.3s
 => [backend 1/6] FROM docker.io/library/python:3.9@sha256:6e9c45244cf9ef21fe9310f6c7bab754c5e4d23c819421f91a2e046e267e823a                                                                                                                                                                                    0.0s
 => [celery internal] load build context                                                                                                                                                                                                                                                                       0.1s
 => => transferring context: 55.86kB                                                                                                                                                                                                                                                                           0.0s
 => [backend internal] load build context                                                                                                                                                                                                                                                                      0.1s
 => => transferring context: 55.86kB                                                                                                                                                                                                                                                                           0.0s
 => [gui internal] load build context                                                                                                                                                                                                                                                                          0.1s
 => => transferring context: 6.90kB                                                                                                                                                                                                                                                                            0.0s
 => [gui 1/5] FROM docker.io/library/node:lts@sha256:8cdf7234449f35e579f7491137807ddb3a089f028862f7ab69af437cc9f47ff1                                                                                                                                                                                          0.0s
 => CACHED [backend 2/6] WORKDIR /app                                                                                                                                                                                                                                                                          0.0s
 => CACHED [celery 3/6] COPY requirements.txt .                                                                                                                                                                                                                                                                0.0s
 => CACHED [celery 4/6] RUN pip install --no-cache-dir -r requirements.txt                                                                                                                                                                                                                                     0.0s
 => [celery 5/6] COPY . .                                                                                                                                                                                                                                                                                      0.6s
 => CACHED [gui 2/5] WORKDIR /app                                                                                                                                                                                                                                                                              0.0s
 => CACHED [gui 3/5] COPY package*.json ./                                                                                                                                                                                                                                                                     0.0s
 => CACHED [gui 4/5] RUN npm install                                                                                                                                                                                                                                                                           0.0s
 => CACHED [gui 5/5] COPY . .                                                                                                                                                                                                                                                                                  0.0s
 => [gui] exporting to image                                                                                                                                                                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                                                                                                                                                                        0.0s
 => => writing image sha256:079049303bcfd5b4b38030ed3aab04bccfa29d33f4989ef40017f983d489fbae                                                                                                                                                                                                                   0.0s
 => => naming to docker.io/library/superagi-gui                                                                                                                                                                                                                                                                0.0s
 => CACHED [backend 3/9] COPY requirements.txt .                                                                                                                                                                                                                                                               0.0s
 => CACHED [backend 4/9] RUN pip install --no-cache-dir -r requirements.txt                                                                                                                                                                                                                                    0.0s
 => CACHED [backend 5/9] COPY . .                                                                                                                                                                                                                                                                              0.0s
 => [backend 6/9] COPY config.yaml ./config.yaml                                                                                                                                                                                                                                                               0.2s
 => [celery 6/6] COPY config.yaml .                                                                                                                                                                                                                                                                            0.3s
 => [backend 7/9] COPY entrypoint.sh /entrypoint.sh                                                                                                                                                                                                                                                            0.2s
 => [celery] exporting to image                                                                                                                                                                                                                                                                                1.7s
 => => exporting layers                                                                                                                                                                                                                                                                                        1.6s
 => => writing image sha256:8a76f1e48b644043e509dd8c2e264d68336fdf76150eca52946303a3b33ee027                                                                                                                                                                                                                   0.0s
 => => naming to docker.io/library/superagi-celery                                                                                                                                                                                                                                                             0.0s
 => [backend 8/9] COPY wait-for-it.sh /wait-for-it.sh                                                                                                                                                                                                                                                          0.2s
 => [backend 9/9] RUN chmod +x /entrypoint.sh /wait-for-it.sh                                                                                                                                                                                                                                                  0.4s
 => [backend] exporting to image                                                                                                                                                                                                                                                                               1.2s
 => => exporting layers                                                                                                                                                                                                                                                                                        1.2s
 => => writing image sha256:12bb23a1511b2ab7d0ea7e121219b92c9f752c275bfb99ff04eda77a8e3c76c6                                                                                                                                                                                                                   0.0s
 => => naming to docker.io/library/superagi-backend                                                                                                                                                                                                                                                            0.0s
[+] Running 4/4
 ✔ Container superagi-super__redis-1  Created                                                                                                                                                                                                                                                                  0.0s 
 ✔ Container superagi-gui-1           Recreated                                                                                                                                                                                                                                                                0.2s 
 ✔ Container superagi-celery-1        Recreated                                                                                                                                                                                                                                                                0.2s 
 ✔ Container superagi-backend-1       Recreated                                                                                                                                                                                                                                                                0.2s 
Attaching to superagi-backend-1, superagi-celery-1, superagi-gui-1, superagi-super__postgres-1, superagi-super__redis-1
superagi-super__redis-1     | 1:C 10 Jun 2023 19:16:22.841 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
superagi-super__redis-1     | 1:C 10 Jun 2023 19:16:22.841 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=1, just started
superagi-super__redis-1     | 1:C 10 Jun 2023 19:16:22.841 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.841 * monotonic clock: POSIX clock_gettime
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.841 * Running mode=standalone, port=6379.
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.841 # Server initialized
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.841 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.842 * Loading RDB produced by version 7.0.11
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.842 * RDB age 13 seconds
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.842 * RDB memory usage when created 0.82 Mb
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.842 * Done loading RDB, keys loaded: 0, keys expired: 0.
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.842 * DB loaded from disk: 0.000 seconds
superagi-super__redis-1     | 1:M 10 Jun 2023 19:16:22.842 * Ready to accept connections
superagi-gui-1              | 
superagi-gui-1              | > super-agi@0.1.0 dev
superagi-gui-1              | > next dev
superagi-gui-1              | 
superagi-gui-1              | - ready started server on 0.0.0.0:3000, url: http://localhost:3000
superagi-gui-1              | - warn Invalid next.config.js options detected: 
superagi-gui-1              | - warn     The root value has an unexpected property, webpackDevMiddleware, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, configOrigin, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, target, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
superagi-gui-1              | - warn See more info here: https://nextjs.org/docs/messages/invalid-next-config
superagi-gui-1              | - event compiled client and server successfully in 994 ms (781 modules)
superagi-gui-1              | - wait compiling...
superagi-gui-1              | - event compiled client and server successfully in 244 ms (781 modules)
superagi-gui-1              | - wait compiling /_error (client and server)...
superagi-gui-1              | - event compiled client and server successfully in 112 ms (782 modules)
superagi-gui-1              | Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap"). Use Document instead. 
superagi-gui-1              | See more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component
superagi-gui-1              | Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"). Use Document instead. 
superagi-gui-1              | See more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component
superagi-gui-1              | - wait compiling /favicon.ico/route (client and server)...
superagi-gui-1              | - event compiled successfully in 70 ms (135 modules)

I did see #275 but none of the accepted solutions there worked. I replaced all instances of localhost and 127.0.0.1 with my LAN IP address, and my config.yaml is up-to-date with the latest commit of the config template including ENV: 'DEV' present.

I am on Arch Linux.

luciferlinx101 commented 1 year ago

@bitnom since you are running backend on different IP, did you add it in docker-compose.yaml ?NEXT_PUBLIC_API_BASE_URL in docker-compose.yaml should have backend URL and to avoid CORS in main.py in origin array add the frontend URL if not running locally.

bitnom commented 1 year ago

NEXT_PUBLIC_API_BASE_URL

Yes, NEXT_PUBLIC_API_BASE_URL got auto-replaced and as I forgot to mention, I also added every possible IP combo to the CORS list.

I had to get back to my regular work for now but thinking about it, it might be as simple as not thinking to add a UFW rule (I do have UFW running) for the ports. However, the 404 might indicate something else.

I copied my config.yaml to an AWS server running Ubuntu 22.04 and it ran as expected.

neelayan7 commented 1 year ago

Hey @bitnom , to further solve this issue we've introduced Nginx as a reverse proxy, which should resolve all CORS issue. Please take the latest pull and try again. Even on codespaces, you can run SuperAGI much simply.

neelayan7 commented 1 year ago

Is this issue resolved?

johnnytomcat commented 2 months ago

Mac users: Updating Docker Desktop and macOS fixed this error for me