Closed ptrxyz closed 7 months ago
A possible workaround would be to make this convention:
The session attribute referencing the user model should always be the pascalCase version of the user model it references.
I guess this needs to be added to the docs then. Alternatively one could consider adding an optional parameter to the Prisma adapter's constructor.
I came across this today. The code you reference was not the issue in my case, but rather the relationship field userId
is what needed to be the same as the documentation. I was able to use a new model names as long as the relation was named userId
.
Yeah unfortunately this is a limitation of the adapter and I'd rather not add an additional config just for it. I've updated the docs though to prevent future issues
Package
@lucia-auth/adapter-prisma
Describe the bug
From the Prisma adapter,
getSessionAndUser
:To determine the name of the field referencing the foreign key of the user in the user model,
userModelKey
is used. HoweveruserModelKey
is simply based on the name of the model, the field name has nothing to do with the model name. This causes an error.