"Encountering the 'GetUserByAccountError' issue with Nextjs version 13.4, next-auth version 4.22.1, and @next-auth/prisma-adapter version 1.0.6

What triggers the error GetUserByAccountError when attempting to log in via SocialLogin with Github or Google? Here is a detailed description of the issue:

Unknown arg `provider_providerAccountId` in where.provider_providerAccountId for type AccountWhereUniqueInput. Did you mean `providerId_providerAccountId`? Available args:
type AccountWhereUniqueInput {
  id?: String
  providerId_providerAccountId?: AccountProviderId_providerAccountIdCompoundUniqueInput
}

 Error:
Invalid `prisma.account.findUnique()` invocation:

{
  where: {
    provider_providerAccountId: {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
      providerAccountId: '100794952997699653180',
      provider: 'google'
    }
  },
  select: {
    user: true
  }
}
(Additional stack trace details follow...)

{
  name: 'GetUserByAccountError',
  code: undefined
}

Steps I have taken to address this issue:

  • Confirming if Prisma Studio functions correctly
  • Verifying proper migration of the database

Reproduction Steps

In app/api/auth/[...nextauth]/route.ts:

(Code snippet from route.ts follows here...)

In schema.prisma:

(Schema definition from schema.prisma follows here...)

When selecting a Gmail account, for instance, I encounter the GetUserByAccountError. The functionality should ideally work without issues. Is there something specific causing this error?

Answer №1

Modify the Account model by replacing providerId with provider.

Explore the Prisma adapter documentation here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The NextJS production build seems to be missing the .next/BUILD_ID directory

I have been experiencing some sporadic instances where the .next/BUILD_ID file is not being generated after a successful build. This issue only started occurring 3 days ago, and I have repeatedly rebuilt the same commit to investigate the root cause. The ...

What is the process for integrating next-i18next translation on a dynamically routed page within a nextjs application?

Currently, I am dealing with a dynamically routed page in Next.js version 10.1.3 at /my-translation/[id]. My goal is to implement the next-i18next package (v8.1.3) for translating this particular page. I have experimented with two different folder structu ...

Error occurred during the Uglify process: Unable to access the 'kind' property as it is undefined

I developed a project using TypeScript (version 3.9.3) and Node (version 10.16.3), but now I want to minify the code by converting it to JavaScript and running UglifyJS. However, after going through this process, the services that were functioning properly ...

What techniques can I use to modify an object while it's being iterated through?

I've been attempting to manipulate the object while looping through it, but unfortunately, it's not working. How can I modify it so that the constant patient includes the property lastActivity inside the this.model array? My code looks like this ...

What setting should I adjust in order to modify the color in question?

Looking to Customize Radar Chart Highlighted Line Colors https://i.sstatic.net/PqWc4.png I am currently working on a Radar Chart and I am trying to figure out which property needs to be edited in order to change the color of the highlighted lines. I have ...

Are website files safe to store in the public_html directory?

Previously, I had a backend built in Laravel and a frontend in React. Recently, someone converted my frontend to Next.js. I noticed that he placed both the frontend and backend in the public folder. Prior to this conversion, I had the website app in a fol ...

Angular 2 Quickstart encountered a 404 error when trying to retrieve the /app/main.js

I'm attempting to follow the Angular 2 quickstart guide, but I'm having trouble getting it to work. I've searched for similar questions but haven't found a solution yet. Can anyone assist me with this? Here is my code: app.component.t ...

After the rendering process, the React Component member goes back to a state of

One issue I encountered is related to a component that utilizes a separate client for making HTTP requests. Specifically, when trying to use the client within a click event handler, the call to this.client.getChannel() fails due to this.client being undefi ...

What is the best way to utilize derived types in TypeScript?

Given object A: interface A { boolProp: boolean, stringProp: string, numberProp: number, ...other props/methods... } Now, I need objects that contain one of the properties from A and set a default value for it, with other properties being irre ...

Managing component composition in React/TypeScript: What's the best way to approach it?

I am brand new to the world of typescript, so please be patient with me. My objective is to transform this react component: interface ButtonProps {...} const Button: React.FC<ButtonProps> = ({ children, href, value as = 'button', ...

Exploring the Differences Between ionViewWillEnter and ionViewDidEnter

When considering whether to reinitiate a cached task, the choice between ionDidLoad is clear. However, when we need to perform a task every time a view is entered, deciding between ionViewWillEnter and ionViewDidEnter can be challenging. No specific guid ...

Sending Angular forms to various endpoints

On a page, I have a form consisting of three different groups this.form = this.formBuilder.group({ profile: this.formBuilder.group({ name: [''], description: [''], }), members: this.formBuilder.array([ this.formBu ...

Challenges with specifying types in a Typescript login function

Currently facing an issue with the login code, where it is meant to authenticate a username and password, retrieve the corresponding hash from the database, compare them, generate a JWT, and send it back to the user: async login(username, password): Promi ...

Is there a way to verify useFormik functionality while the form is being submitted?

Below is the implementation of the Form component which utilizes the useFormik hook. While the component fulfills all my requirements, I encounter challenges when it comes to testing, especially during form submission. Form.tsx import { TextField, But ...

Transform a YAML document into either a JSON blueprint or a TypeScript structure

Currently seeking an efficient tool, preferably in Node JS, that can convert a YAML file from swagger into either a JSON SCHEMA or a typescript interface. The process I have used so far is: YAML->RAML->JSON SCHEMA->TYPESCRIPT interface STEP1: Co ...

What is the method for throwing errors with NestJS guards without relying on an authentication module?

Are you looking to customize error responses in NestJS guards? import { CanActivate, Injectable, ExecutionContext, NotFoundException } from '@nestjs/common'; import { Observable } from 'rxjs'; import { InjectModel } from '@nestjs/m ...

Using Javascript or ES6, you can compare a nested array object with another array of elements and generate a new array based on

I am dealing with a complicated array structure as shown below sectionInfo = [{id: 1, name:'ma'}, {id: 2, name:'na'}, {id: 3, name:'ra'}, {id: 4, name:'ka'}, {id: 5, name:'pa'}]; abc = [{id:'1' ...

Tips for implementing a personalized 410 error page in a Next.js 13 application router

I’m currently working on implementing error handling for 410 status codes in my Next.js 13 application router. I’ve already created a notFound page, which is straightforward to handle with Next.js. However, I’m struggling to find a way to show a cu ...

Troubleshooting issue with Vue3 - TS Custom State Management

Issue: I am facing a challenge in transferring data between two separate components - the main component and another component. Despite attempting to implement reactive State Management based on Vue documentation, the object's value remains unchanged ...

Ways to retrieve a URL from the assets folder

I need to establish a baseUrl for my backend requests within the assets folder. For this, I have created a server configuration file named config.json { "backendServer": { "protocol": "http", "host": " ...