t3-oss / create-t3-app

The best way to start a full-stack, typesafe Next.js app
https://create.t3.gg
MIT License
25.11k stars 1.15k forks source link

bug: When NextAuth authentication provider is selected, the Next Steps section need to indicate setting up Discord client info in .env file #1812

Open coombsj opened 6 months ago

coombsj commented 6 months ago

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

test-app@0.1.0 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.

sahilrajput03 commented 6 months ago

I fixed this issue by simply updating discord environment variables like shown below in .env file:

DISCORD_CLIENT_ID="sample"
DISCORD_CLIENT_SECRET="sample"
sahilrajput03 commented 6 months ago

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(),
kakenbutter commented 5 months ago

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