nextauthjs / nextauthjs/next-auth
Extending models
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 4k
- PR merge metrics
- No merged PRs in 30d
Description
Question 💬
I'm trying to alter my user schema to take in a couple more details.
Following the docs here.
The problem is when I even try and use the provided models it still breaks with the error GetUserByEmailError: column "emailVerified" does not exist doesn't make sense since I can see it exists and there are even users.
I'm using the email provider but I don't think I have altered anything that should cause it to break. 🤔
I'm probably missing something (or my coffee isn't strong enough).
NextAuth(req, res, {
adapter: SequelizeAdapter(sequelize, {
synchronize: true,
models: {
User: sequelize.define('user', {
...models.User,
}),
},
}),
providers: [
EmailProvider({
...
How to reproduce ☕️
// importing the models
import SequelizeAdapter, { models } from '@next-auth/sequelize-adapter';
// then setting up the adapter to prepare to extend the user model
adapter: SequelizeAdapter(sequelize, {
synchronize: true,
models: {
User: sequelize.define('user', {
...models.User,
}),
},
}),
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SequelizeAdapter configuration and the custom models.User definition shown in the issue, then reproduce the email-provider GetUserByEmailError. Compare the generated or queried column name with the documented custom-model setup; done means extending the User model no longer produces the missing emailVerified error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs, nodejs, typescript
- Domain
- authentication, backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100