Next.js Discord

Discord Forum

Missing Secrets

Unanswered
Ragdoll posted this in #help-forum
Open in Discord
RagdollOP
[auth][error] MissingSecret: Please define a Secret.

Why do I get these error even though I have set the AUTH_SECRET specify in the doc
https://authjs.dev/reference/core/errors/#missingsecret

19 Replies

@Ray how do you set the secret?
RagdollOP
inside .env.example
change the name to .env.local
or .env
RagdollOP
nextjs don't read the values inside .example?
@Ray no
RagdollOP
still getting the same error
MissingSecret: Please define a secret. .Read more at https://errors.authjs.dev#missingsecret
@Ray what is the variable name
RagdollOP
they are already predefined in the template, I just put the values
https://vercel.com/templates/next.js/nextjs-ai-chatbot
@Ray you cloned this repo?
RagdollOP
I deployed it first, vercel created repo and setup DB for me during the process
and to run it locally, I clone the repo that it created in my github acc
@Ragdoll and to run it locally, I clone the repo that it created in my github acc
make sure you have AUTH_SECRET inside .env.local or .env file
@Ragdoll I do have it
does it work if you add secret: process.env.AUTH_SECRET in auth.ts?
@Ray does it work if you add `secret: process.env.AUTH_SECRET` in `auth.ts`?
RagdollOP
It does, after restarting the server, thanks.
Though I am getting this error now
⨯ Error [TypeError]: immutable