create-t3-app icon indicating copy to clipboard operation
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

Open coombsj opened this issue 1 year ago • 3 comments

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.

coombsj avatar Mar 27 '24 15:03 coombsj

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 avatar Apr 01 '24 23:04 sahilrajput03

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(),

sahilrajput03 avatar Apr 02 '24 01:04 sahilrajput03

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

kakenbutter avatar Apr 10 '24 23:04 kakenbutter