Api key plugin with Prisma and express server
Hi everyone,
Has anyone gotten the api key plugin working with prisma in a separate express.js server?
i've implemented the ApiKey schema like so:
But i keep getting this error when i try to create new api key from my client:
````
file:///Users/user/dev/project/repo_name/backend/node_modules/.pnpm/[email protected]/node_modules/better-auth/dist/shared/better-auth.rSYJCd3o.mjs:96
return schema[model].modelName !== model ? schema[model].modelName : config.usePlural ?
${model}s` : model;
^
TypeError: Cannot read properties of undefined (reading 'modelName')
````4 Replies
And for reference here is how i configured my plugin server-side:
Just a side note, it's aside to your issue, but
metadata
should be a string, Better Auth doesn't have built-in functionality to store JSON fields yetHey I just opened a PR, and hopefully this will address your issue.
https://github.com/better-auth/better-auth/pull/2629
Hi! Thanks for the quick investigation, was pulling my hair a little bit. Rolled back to rolling my own api keys for now but will give this another try as soon as the PR is merged.