#MongoDB, Next-Auth, Strava Provider ID Problems

4 messages · Page 1 of 1 (latest)

fossil lotus
#

Hello guys! :) I am using next with prisma and mongoDB and i use the next-auth for authentication, everything is kinda working, but when i get redirected to the Strava Login Page, then i receive the callback but then i get this error message.
Unknown argument id. Available options are listed in green. PrismaClientValidationError:
Invalid prisma.account.create() invocation:

    provider: "strava",
    type: "oauth",
    providerAccountId: "121757184",
    token_type: "Bearer",
    expires_at: 1690308595,
    refresh_token: "69742995556e623a96f409d5dfb6a505a65060bc",
    access_token: "f67a5581a2eea1e7772093fc11c0ef199a4b5bdf",
    athlete: {
      id: 121757184,
      ~~```
I cutted the error here because it shows me the error here on ID.

This is my Athlete model
```model Athlete {
  id               String     @id @default(auto()) @map("_id") @db.ObjectId
  username         String?
  resource_state   Int?
  firstname        String?
  lastname         String?
  bio              String?
  city             String?
  state            String?
  country          String?
  sex              String?
  premium          Boolean?
  summit           Boolean?
  created_at       String?
  updated_at       String?
  badge_type_id    Int?
  weight           String?
  profile_medium   String?
  profile          String?
  friend           String?
  follower         String?

  account Account? @relation(fields: [accountAthleteId], references: [id])
  accountAthleteId String? @unique @db.ObjectId
}``` i hope i can find some help here :) thanks!
prisma sapphire
#

Hello 👋

In your model id is defined as a string but it looks like you are passing a number value in the id column?

fossil lotus
#

Hey Nurul! Yes, because mongoDB provides a string.

#

i still run in to issue and have no idea :s