Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Next Auth Sign Up Default User Id Missing #1914

Closed
jcappel opened this issue Jun 14, 2024 · 3 comments
Closed

bug: Next Auth Sign Up Default User Id Missing #1914

jcappel opened this issue Jun 14, 2024 · 3 comments

Comments

@jcappel
Copy link

jcappel commented Jun 14, 2024

Provide environment information

System:
OS: macOS 14.1
CPU: (10) arm64 Apple M1 Pro
Memory: 249.63 MB / 32.00 GB
Shell: 3.5.1 - /opt/homebrew/bin/fish
Binaries:
Node: 21.0.0 - ~/.nvm/versions/node/v21.0.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 10.2.0 - ~/.nvm/versions/node/v21.0.0/bin/npm
pnpm: 9.3.0 - ~/.nvm/versions/node/v21.0.0/bin/pnpm
bun: 1.1.13 - ~/.bun/bin/bun

Describe the bug

Following the t3 installation guide results and further using next auth, drizzle and postgres results in an oauth error when trying to login with an oauth provider.
It seems like the t3 drizzle schema needs to be updated to allow creating a default user id as stated in the auth.js docs:

export const users = pgTable("user", {
  id: text("id")
    .primaryKey()
    .$defaultFn(() => crypto.randomUUID()),
  name: text("name"),
  email: text("email").notNull(),
  emailVerified: timestamp("emailVerified", { mode: "date" }),
  image: text("image"),
})

Currently the default function is missing in the default t3 installation.
By adding the default function the issue should be fixed.

Reproduction repo

To reproduce

Create a t3 app using CreateT3App and choose NextAuth, Drizzle and Postgres.

Additional information

No response

@Velua
Copy link

Velua commented Jun 15, 2024

Just ran into this as well!

@abaudhuin
Copy link

abaudhuin commented Jun 20, 2024

Encountered the same issue after initial setup.
Thanks for the fix

@juliusmarminge
Copy link
Member

Fixed in #1909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants