Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agentgpt image build failure #147

Closed
xinmans opened this issue Apr 15, 2023 · 13 comments · Fixed by #155
Closed

agentgpt image build failure #147

xinmans opened this issue Apr 15, 2023 · 13 comments · Fixed by #155

Comments

@xinmans
Copy link

xinmans commented Apr 15, 2023

docker build -t agentgpt .
Sending build context to Docker daemon 1.396MB
Step 1/10 : FROM node:19-alpine
---> adb3ed8bc61e
Step 2/10 : WORKDIR /app
---> Using cache
---> cba5f0a07260
Step 3/10 : COPY package*.json ./
---> Using cache
---> de120e187c24
Step 4/10 : RUN npm ci
---> Using cache
---> 626b7451784c
Step 5/10 : COPY . .
---> Using cache
---> 2ce6e3f77cbf
Step 6/10 : RUN mv .env.docker .env && sed -ie 's/postgresql/sqlite/g' prisma/schema.prisma && sed -ie 's/mysql/sqlite/g' prisma/schema.prisma && sed -ie 's/@db.Text//' prisma/schema.prisma
---> Using cache
---> 946699f0db5f
Step 7/10 : EXPOSE 3000
---> Using cache
---> ac2710a70fba
Step 8/10 : RUN npx prisma generate && npx prisma migrate dev --name init && npx prisma db push
---> Using cache
---> 1a10684d6c89
Step 9/10 : RUN npm run build
---> Running in 14303914832d

agent-gpt@0.1.0 build
next build --no-lint

warn - Linting is disabled
info - Loaded env from /app/.env
❌ Invalid environment variables:
GOOGLE_CLIENT_ID: Required
GOOGLE_CLIENT_SECRET: Required
GITHUB_CLIENT_ID: Required
GITHUB_CLIENT_SECRET: Required
DISCORD_CLIENT_ID: Required
DISCORD_CLIENT_SECRET: Required

error - Failed to load next.config.mjs, see more info here https://nextjs.org/docs/messages/next-config-error

Build error occurred
Error: Invalid environment variables
at file:///app/src/env/server.mjs:16:9
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
The command '/bin/sh -c npm run build' returned a non-zero code: 1

@amin24e
Copy link

amin24e commented Apr 15, 2023

same here plz help

@gif-gif
Copy link

gif-gif commented Apr 15, 2023

same here too

@awtkns
Copy link
Member

awtkns commented Apr 15, 2023

Thanks guys. This was caused by a recent pr. Should be fixed later today hopefully.

@exil0867
Copy link
Contributor

Hello @awtkns, my PR should get it fixed 😁.

@jasonhemann
Copy link

I'm seeing an error that looks like an artifact of this. Related?

2023-04-15 09:32:40 > agent-gpt@0.1.0 start
2023-04-15 09:32:40 > next start
2023-04-15 09:32:40 
2023-04-15 09:32:40 ready - started server on 0.0.0.0:3000, url: http://localhost:3000
2023-04-15 09:32:40 info  - Loaded env from /app/.env
2023-04-15 09:32:40 warn  - You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
2023-04-15 09:32:55 ❌ Invalid environment variables:
2023-04-15 09:32:55  GOOGLE_CLIENT_ID: Required
2023-04-15 09:32:55  GOOGLE_CLIENT_SECRET: Required
2023-04-15 09:32:55  GITHUB_CLIENT_ID: Required
2023-04-15 09:32:55  GITHUB_CLIENT_SECRET: Required
2023-04-15 09:32:55  DISCORD_CLIENT_ID: Required
2023-04-15 09:32:55  DISCORD_CLIENT_SECRET: Required
2023-04-15 09:32:55 

Steps:

git clone
chmod u+x setup.sh
./setup.sh --docker
docker logs

@exil0867
Copy link
Contributor

exil0867 commented Apr 15, 2023

I'm seeing an error that looks like an artifact of this. Related?

2023-04-15 09:32:40 > agent-gpt@0.1.0 start
2023-04-15 09:32:40 > next start
2023-04-15 09:32:40 
2023-04-15 09:32:40 ready - started server on 0.0.0.0:3000, url: http://localhost:3000
2023-04-15 09:32:40 info  - Loaded env from /app/.env
2023-04-15 09:32:40 warn  - You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env
2023-04-15 09:32:55 ❌ Invalid environment variables:
2023-04-15 09:32:55  GOOGLE_CLIENT_ID: Required
2023-04-15 09:32:55  GOOGLE_CLIENT_SECRET: Required
2023-04-15 09:32:55  GITHUB_CLIENT_ID: Required
2023-04-15 09:32:55  GITHUB_CLIENT_SECRET: Required
2023-04-15 09:32:55  DISCORD_CLIENT_ID: Required
2023-04-15 09:32:55  DISCORD_CLIENT_SECRET: Required
2023-04-15 09:32:55 

Steps:

git clone chmod u+x setup.sh ./setup.sh --docker docker logs

A fix has been merged already, please run git pull origin main and then ./setup.sh --docker.

@jasonhemann
Copy link

@exilvm I'd already done that; I'm up to date wrt main. I'm still seeing this issue. Related?

@exil0867
Copy link
Contributor

@exilvm I'd already done that; I'm up to date wrt main. I'm still seeing this issue. Related?

Show us the content of .env and .env.docker.

@jasonhemann
Copy link

Here's the result of pull, status, setup,

[jhemann:AgentGPT] 10:07:08$ git pull origin main
From github.com:reworkd/AgentGPT
 * branch            main       -> FETCH_HEAD
Already up to date.
[jhemann:AgentGPT] 10:07:12$ git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
[jhemann:AgentGPT] 10:08:42$ chmod u+x setup.sh
[jhemann:AgentGPT] 10:09:44$ ./setup.sh --docker
Enter your OpenAI Key (eg: sk...): sk-123
[+] Building 27.0s (13/13) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                            0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                                                             0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                               0.0s
 => => transferring context: 34B                                                                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/node:19-alpine                                                                                                                                                                               0.3s
 => [1/8] FROM docker.io/library/node:19-alpine@sha256:53741c7511b1836b5eb7e788a7b399c058b0b549f205d2c6af831ec1a9a81c31                                                                                                                         0.0s
 => [internal] load build context                                                                                                                                                                                                               0.0s
 => => transferring context: 4.61kB                                                                                                                                                                                                             0.0s
 => CACHED [2/8] WORKDIR /app                                                                                                                                                                                                                   0.0s
 => CACHED [3/8] COPY package*.json ./                                                                                                                                                                                                          0.0s
 => CACHED [4/8] RUN npm ci                                                                                                                                                                                                                     0.0s
 => [5/8] COPY . .                                                                                                                                                                                                                              0.0s
 => [6/8] RUN mv .env.docker .env      && sed -ie 's/postgresql/sqlite/g' prisma/schema.prisma     && sed -ie 's/mysql/sqlite/g' prisma/schema.prisma    && sed -ie 's/@db.Text//' prisma/schema.prisma                                         0.1s
 => [7/8] RUN npx prisma generate      && npx prisma migrate dev --name init      && npx prisma db push                                                                                                                                         5.7s
 => [8/8] RUN npm run build                                                                                                                                                                                                                    20.6s
 => exporting to image                                                                                                                                                                                                                          0.2s
 => => exporting layers                                                                                                                                                                                                                         0.2s
 => => writing image sha256:1e44e0ccb827b6b8f3c7e406a14c05de56c0da3d4309e8e6ba4aad25c2f6acbd                                                                                                                                                    0.0s
 => => naming to docker.io/library/agentgpt                                                                                                                                                                                                     0.0s
81b655d8395a4e8694275d10006e61e9e090e2fae3a19c53e66fec435422eba8
[jhemann:AgentGPT] 10:10:43$ cat .env
NODE_ENV=development
NEXTAUTH_SECRET=1234
NEXTAUTH_URL=http://localhost:3000
OPENAI_API_KEY=sk-123
DATABASE_URL=file:../db/db.sqlite
[jhemann:AgentGPT] 10:10:48$ cat .env.docker
NODE_ENV=development
NEXTAUTH_SECRET=1234
NEXTAUTH_URL=http://localhost:3000
OPENAI_API_KEY=sk-123
DATABASE_URL=file:../db/db.sqlite
[jhemann:AgentGPT] 10:10:54$

after startup, before visiting localhost:3000

2023-04-15 10:10:43 
2023-04-15 10:10:43 > agent-gpt@0.1.0 start
2023-04-15 10:10:43 > next start
2023-04-15 10:10:43 
2023-04-15 10:10:43 ready - started server on 0.0.0.0:3000, url: http://localhost:3000
2023-04-15 10:10:43 info  - Loaded env from /app/.env
2023-04-15 10:10:43 warn  - You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env

additions after visiting:
image

@exil0867
Copy link
Contributor

exil0867 commented Apr 15, 2023

Hi @jasonhemann!

I was able to reproduce that error, although it only occurs inside the container, the app will still run just fine.

I understand the cause of the error and i will look more into it when i can. Thanks for your feedback! 👍.

@jasonhemann
Copy link

@exilvm , thank you very much for the update. I can't be sure this is related, but on my system any bot I attempt to write fails to run, and the log reports the same error message:

2023-04-15 11:46:01 
2023-04-15 11:46:01 Error: Invalid environment variables
2023-04-15 11:46:01     at /app/.next/server/chunks/476.js:257:11
2023-04-15 11:46:01     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-04-15 11:46:01 Error: Invalid environment variables
2023-04-15 11:46:01     at /app/.next/server/chunks/476.js:257:11
2023-04-15 11:46:01     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-04-15 11:47:56 RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: 0
2023-04-15 11:47:56     at new NodeError (node:internal/errors:399:5)
2023-04-15 11:47:56     at ServerResponse.writeHead (node:_http_server:339:11)
2023-04-15 11:47:56     at ServerResponse.writeHead (/app/node_modules/next/dist/compiled/compression/index.js:46:263)
2023-04-15 11:47:56     at ServerResponse._implicitHeader (node:_http_server:330:8)
2023-04-15 11:47:56     at ServerResponse.end (/app/node_modules/next/dist/compiled/compression/index.js:22:749)
2023-04-15 11:47:56     at NextNodeServer.runEdgeFunction (/app/node_modules/next/dist/server/next-server.js:1461:41)
2023-04-15 11:47:56     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2023-04-15 11:47:56     at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:468:47)
2023-04-15 11:47:56     at async Object.fn (/app/node_modules/next/dist/server/next-server.js:751:37)
2023-04-15 11:47:56     at async Router.execute (/app/node_modules/next/dist/server/router.js:253:36) {
2023-04-15 11:47:56   code: 'ERR_HTTP_INVALID_STATUS_CODE'
2023-04-15 11:47:56 }

It's /possible/ that I am assigning tasks too difficult, but I don't suspect that's the case.

image

I did, of course, retry to no avail.

@Lone333
Copy link

Lone333 commented Apr 16, 2023

same here too,vercel deploy

@aiastia
Copy link

aiastia commented Apr 19, 2023

I found that in env add

GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
DISCORD_CLIENT_ID=your-discord-client-id
DISCORD_CLIENT_SECRET=your-discord-client-secret 

can run normally npm run build
Without these variables, only
npm run dev normal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants