joschan21 / similarity-api

https://www.similarityapi.com/
630 stars 128 forks source link

Prisma problem after sign in #12

Open dennisdingo28 opened 1 year ago

dennisdingo28 commented 1 year ago

Hello there,I've got some problems with prisma after trying to sign in.It should redirect me to the /dashboard (http://localhost:3000/dashboard) but instead it redirects to a 404 page with the url of http://localhost:3000/login?callbackUrl=%2Fdashboard&error=Callback even if i have the dashboard page ready up. Also there is a ton of errors from prisma after the sign in process such as "Invalid prisma.account.findUnique() invocation: { where: { provider_providerAccountId: {


      providerAccountId: '....',
      provider: 'google'
    }
  },
  select: {
    user: true
  }
}"

I also tried to change to exact same version of prisma, as the time i was watching the video,prisma have been updated their app and I do not know how to solve this. Thanks!
alphawhiskey03 commented 1 year ago

i get this error as well. Found any solution?

Olacdy commented 1 year ago

I had the similar problem, try to use these models:

model Account {
  id                 String  @id @default(cuid())
  userId             String
  type               String
  provider           String
  providerAccountId  String
  refresh_token      String?  @db.Text
  access_token       String?  @db.Text
  expires_at         Int?
  token_type         String?
  scope              String?
  id_token           String?  @db.Text
  session_state      String?

  user User @relation(fields: [userId], references: [id], onDelete: Cascade)

  @@unique([provider, providerAccountId])
}

model Session {
  id           String   @id @default(cuid())
  sessionToken String   @unique
  userId       String
  expires      DateTime
  user         User     @relation(fields: [userId], references: [id], onDelete: Cascade)
}

model User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
}

model VerificationToken {
  identifier String
  token      String   @unique
  expires    DateTime

  @@unique([identifier, token])
}
kiritocode1 commented 11 months ago

yess this solution worked for me thanks @DBoFury