New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kysely Adapter' Database interface mismatch with provided schema in docs and kysely schema rules #10441
Comments
AchalS-iglu
added
adapters
Changes related to the core code concerning database adapters
bug
Something isn't working
triage
Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
labels
Mar 29, 2024
This was referenced Mar 31, 2024
The error
|
Are you using some kind of code gen? Then this snippet might help.
Found in the docs here: https://authjs.dev/reference/adapter/kysely#kyselyauthdb-t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Adapter type
@auth/kysely-adapter
Environment
System:
OS: Linux 6.7 EndeavourOS
CPU: (8) x64 AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx
Memory: 1.15 GB / 6.72 GB
Container: Yes
Shell: 5.2.26 - /bin/bash
Binaries:
Node: 21.4.0 - ~/.nvm/versions/node/v21.4.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v21.4.0/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v21.4.0/bin/npm
bun: 1.0.31 - ~/.bun/bin/bun
Browsers:
Chromium: 122.0.6261.128
npmPackages:
@auth/drizzle-adapter: ^0.7.0 => 0.7.0
@auth/kysely-adapter: ^0.6.1 => 0.6.1
next: ^14.1.3 => 14.1.4
next-auth: ^4.24.6 => 4.24.7
react: 18.2.0 => 18.2.0
Reproduction URL
https://github.com/traveltoindia-co-in/ta
Describe the issue
So, I used the schema provided in the docs but it is incompatible with the adapter's constructor
KyselyAuth
. Look atsrc/types/authTypes.ts
. These types are then put into the Database interface insrc/types/database.ts
. Then that interface is further passed into the Adapter's constructor in filesrc/server/database.ts
, however it is incompatible. The Adapter uses standard typescript typing rather than Kysely's format, meanwhile the docs have proper schema.The adapter's internal database type refers to the core types.
Suggested interface for said type -
I hope this is appropriate in terms of Kysely (I have actually never used kysely before). Also, Kysely tells to
| null
instead of optional ? or undefined. If I were to use Selectable instead of T (T being any of the table model above) then I believe it would match perfectly. However I am getting numerous errors on trying to assign Database schema to the adapter's constructor, there could be more, I do not know.I hope I am correct I could be entirely wrong and using the lib incorrectly.
How to reproduce
Look at intellisense I suppose or run ts check
Expected behavior
No TS errors.
The text was updated successfully, but these errors were encountered: