Skip to content

Problem with Strava provider #5272

@johann-arias

Description

@johann-arias

Question 💬

Hello guys,

I'm new to next.js and next-auth and I'm trying to implet a sign-in with Strava feature. I followed this tutorial for Github : https://vercel.com/guides/nextjs-prisma-postgres and tried to make it work with Strava

You can find my code here : https://github.com/johann-arias/strava-stats

When I click the "Sign in with Strava" button, I get an error displayed in the browser :

Capture d’écran 2022-09-01 à 15 53 14

And here's what's my terminals shows :

 Error:
Invalid `p.account.create()` invocation in
/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@next-auth/prisma-adapter/dist/index.js:19:42

  16 },
  17 updateUser: ({ id, ...data }) => p.user.update({ where: { id }, data }),
  18 deleteUser: (id) => p.user.delete({ where: { id } }),
→ 19 linkAccount: (data) => p.account.create({
       data: {
         provider: 'strava',
         type: 'oauth',
         providerAccountId: '49310442',
         token_type: 'Bearer',
         expires_at: 1662057083,
         refresh_token: '4cedaeac0b879c9938feb29aedf864948fe8c7b6',
         access_token: '4e176a36093404b850eedc4f0b6896f89d4cc309',
         athlete: {
         ~~~~~~~
           id: 49310442,
           username: null,
           resource_state: 2,
           firstname: 'Johann',
           lastname: 'Arias',
           bio: null,
           city: 'Paris',
           state: 'Île-de-France',
           country: 'France',
           sex: null,
           premium: true,
           summit: true,
           created_at: '2019-12-28T13:51:16Z',
           updated_at: '2022-08-19T16:00:14Z',
           badge_type_id: 1,
           weight: null,
           profile_medium: 'https://dgalywyr863hv.cloudfront.net/pictures/athletes/49310442/13342948/1/medium.jpg',
           profile: 'https://dgalywyr863hv.cloudfront.net/pictures/athletes/49310442/13342948/1/large.jpg',
           friend: null,
           follower: null
         },
         userId: 'cl7j2tl2a0026d7whtttyver6'
       }
     })

Unknown arg `athlete` in data.athlete for type AccountUncheckedCreateInput. Did you mean `type`? Available args:
type AccountUncheckedCreateInput {
  id?: String
  userId: String
  type: String
  provider: String
  providerAccountId: String
  refresh_token?: String | Null
  access_token?: String | Null
  expires_at?: Int | Null
  token_type?: String | Null
  scope?: String | Null
  id_token?: String | Null
  session_state?: String | Null
  oauth_token_secret?: String | Null
  oauth_token?: String | Null
}


    at Document.validate (/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:28174:20)
    at serializationFn (/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:30774:19)
    at runInChildSpan (/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:24002:12)
    at PrismaClient._executeRequest (/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:30781:31)
    at consumer (/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:30707:23)
    at /Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:30712:51
    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)
    at /Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:30712:29
    at runInChildSpan (/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:24002:12)
    at PrismaClient._request (/Users/johann/Documents/dev/blogr-nextjs-prisma/node_modules/@prisma/client/runtime/index.js:30709:22) {
  name: 'LinkAccountError',
  code: undefined
}

A user is created in my database :

Capture d’écran 2022-09-01 à 15 56 03

Thanks a lot for your help

How to reproduce ☕️

https://github.com/johann-arias/strava-stats

go to localhost:3000, click on "Log In" and "Sign in with Strava"

Contributing 🙌🏽

No, I am afraid I cannot help regarding this

Metadata

Metadata

Assignees

No one assigned

    Labels

    prisma@auth/prisma-adapterquestionAsk how to do something or how something works

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions