create-t3-app
create-t3-app copied to clipboard
bug: When NextAuth authentication provider is selected, the Next Steps section need to indicate setting up Discord client info in .env file
Provide environment information
System: OS: macOS 11.7.10 CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz Memory: 148.06 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 21.7.1 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 10.5.0 - /usr/local/bin/npm pnpm: 8.15.5 - ~/Library/pnpm/pnpm
"ct3aMetadata": { "initVersion": "7.30.0" }
Describe the bug
npm run dev
[email protected] dev next dev
❌ Invalid environment variables: { DISCORD_CLIENT_ID: [ 'Required' ], DISCORD_CLIENT_SECRET: [ 'Required' ] }
Node.js v21.7.1
Reproduction repo
Part of setting up the project nothing to deploy yet.
To reproduce
Ran npm create t3-app@latest to create new app with the following selections:
│ ◇ What will your project be called? │ test-app │ ◇ Will you be using TypeScript or JavaScript? │ TypeScript │ ◇ Will you be using Tailwind CSS for styling? │ Yes │ ◇ Would you like to use tRPC? │ Yes │ ◇ What authentication provider would you like to use? │ NextAuth.js │ ◇ What database ORM would you like to use? │ Prisma │ ◇ EXPERIMENTAL Would you like to use Next.js App Router? │ Yes │ ◇ What database provider would you like to use? │ SQLite │ ◇ Should we initialize a Git repository and stage the changes? │ Yes │ ◇ Should we run 'npm install' for you? │ Yes │ ◇ What import alias would you like to use? │ ~/
Using: npm
Followed next steps provided: cd test-app npm run db:push npm run dev
Additional information
Suggestion to enhance next steps section to include something about setting environment variables when using NextAuth.
I fixed this issue by simply updating discord environment variables like shown below in .env file:
DISCORD_CLIENT_ID="sample"
DISCORD_CLIENT_SECRET="sample"
Also, you can fix it via making discord env values optional in env.js file:
DISCORD_CLIENT_ID: z.string().optional(),
DISCORD_CLIENT_SECRET: z.string().optional(),
I believe there is a section in the "First Steps" part of create-t3-app's documentation that addresses this issue. Look under "Authentication": https://create.t3.gg/en/usage/first-steps