fuseai icon indicating copy to clipboard operation
fuseai copied to clipboard

secret missing in docker image.

Open P6g9YHK6 opened this issue 2 years ago • 7 comments

the new docker image produce this error on my side:

[next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret Warning: For production Image Optimization with Next.js, the optional 'sharp' package is strongly recommended. Run 'yarn add sharp', and Next.js will use it automatically for Image Optimization. Read more: https://nextjs.org/docs/messages/sharp-missing-in-production [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret Please define a secret in production. MissingSecret [MissingSecretError]: Please define a secret in production. at assertConfig (/app/node_modules/next-auth/core/lib/assert.js:42:12) at AuthHandler (/app/node_modules/next-auth/core/index.js:70:52) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async NextAuthHandler (/app/node_modules/next-auth/next/index.js:24:19) at async /app/node_modules/next-auth/next/index.js:60:32 at async Object.apiResolver (/app/node_modules/next/dist/server/api-utils/node.js:372:9) at async NextNodeServer.runApi (/app/node_modules/next/dist/server/next-server.js:514:9) at async Object.fn (/app/node_modules/next/dist/server/next-server.js:828:35) at async Router.execute (/app/node_modules/next/dist/server/router.js:243:32) at async NextNodeServer.runImpl (/app/node_modules/next/dist/server/base-server.js:432:29) { code: 'NO_SECRET' } [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret [next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret Please define a secret in production. MissingSecret [MissingSecretError]: Please define a secret in production.

P6g9YHK6 avatar Mar 18 '23 11:03 P6g9YHK6

docker run -p 3000:3000 -e NEXTAUTH_SECRET=<random strong password> docker.io/bitswired/ai-chat-app

But then I'm stuck after sign in Screenshot 2023-03-19 at 12 35 18 pm

thomasWos avatar Mar 19 '23 01:03 thomasWos

Hi guys,

With the new version you need to run the Docker image with environment variables as follows:

docker run -p 3000:3000 --env-file=.env aichatapp

Inside the .env file you need the following variables for the single user setup:

DATABASE_URL="file:./db.sqlite"
NEXTAUTH_SECRET="secret"
NEXTAUTH_URL="http://localhost:3000"

[email protected]
ADMIN_PASSWORD=password

For the multi-user setup:

DATABASE_URL="file:./db.sqlite"
NEXTAUTH_SECRET="secret"
NEXTAUTH_URL="http://localhost:3000"

[email protected]

NEXT_PUBLIC_MULTI_USER=1
EMAIL_SERVER_HOST=smtp.gmail.com
EMAIL_SERVER_PORT=465
[email protected]
EMAIL_SERVER_PASSWORD=password
[email protected]

If you use the single-user setup, it uses the ADMIN_EMAIL and ADMIN_PASSWORD for login.

Otherwise, it uses password-less authentication.

Does it solves your issue?

jimzer avatar Mar 19 '23 20:03 jimzer

Thanks for that. For some reasons... the URL with double quotes doesn't work . Using DATABASE_URL=file:./db.sqlite instead of DATABASE_URL="file:./db.sqlite" fixes the problem.

But then, same result, I cannot login, the page stays blocked on Sign In

thomasWos avatar Mar 20 '23 11:03 thomasWos

@thomasWos

Could you try this exact command? It's the one I use, and it works for me. It''s for the single user setup.

docker run -p 3000:3000 \
  -e DATABASE_URL=file:./db.sqlite \
  -e NEXTAUTH_SECRET=secret \
  -e NEXTAUTH_URL=http://localhost:3000/ \
  -e [email protected] \
  -e ADMIN_PASSWORD=password \
  bitswired/ai-chat-app:single-user-latest

Then you should be able to log in with:

jimzer avatar Mar 20 '23 15:03 jimzer

It works with this exact command. I can login, thanks!

thomasWos avatar Mar 24 '23 06:03 thomasWos

I'm glad it works for you now @thomasWos :)

jimzer avatar Mar 24 '23 12:03 jimzer

yeah it works! still have no chat output, but that's another issue.

thomasWos avatar Mar 26 '23 21:03 thomasWos