Hi, im trying to set up betterauth but when I run
npx @better-auth/cli generate
I get the following error:
2025-08-05T12:05:44.299Z WARN [Better Auth]: Social provider discord is missing clientId or clientSecret
- preparing schema...node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
AggregateError [ECONNREFUSED]:
at internalConnectMultiple (node:net:1134:18)
at afterConnectMultiple (node:net:1715:7) {
code: 'ECONNREFUSED',
fatal: true,
[errors]: [
Error: connect ECONNREFUSED ::1:3306
at createConnectionError (node:net:1678:14)
at afterConnectMultiple (node:net:1708:16) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 3306
},
Error: connect ECONNREFUSED 127.0.0.1:3306
at createConnectionError (node:net:1678:14)
at afterConnectMultiple (node:net:1708:16) {
errno: -4078,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 3306
}
]
}
Node.js v24.5.0
Now I believe I have narrowed it down to the environment variables being undefined so I wanted to make sure im not doing anything wrong?
I've created a .env.local file in the root of the nextjs project
<project-name>
-/src
-- /app
- .env.local
Then in my
/<project-name>/lib/auth.ts
I reference the variables in the following way