I'm developing a web application using Next.js and implementing an authentication system with NextAuth.js and FaunaDB through the Fauna adapter. Despite following the official documentation for both NextAuth and the Fauna adapter, I'm encountering a critical error during the user authentication process.
adapter_createUser {
"args": [
{
"id": "540bc67d-4e79-4b25-test",
"name": "tes",
"email": "test@gmail.com",
"image": "https://lh3.googleusercontent.com/a/test=s96-c",
"emailVerified": null
}
]
}
[auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror
[auth][cause]: ConstraintFailureError: Failed to create document in collection `User`.
[auth][details]: {}
[auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror
[auth][cause]: ConstraintFailureError: Failed to create document in collection `User`.
[auth][details]: {}
[auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror
[auth][cause]: ConstraintFailureError: Failed to create document in collection `User`.
[auth][details]: {}
[auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror
[auth][cause]: ConstraintFailureError: Failed to create document in collection `User`.
[auth][details]: {}
I've followed the documentation for the FaunaAdapter to the letter created the schemas for the necessary tables as indicated but after trying to debug the issue using the Fauna Dashboard I noticed that the id field is a reserved field in fauna but still we could create User documents using custom ids that we provide up to a certain length and then it would give us the following error:
and since the id that the social providers return is usually a too long the create_User function from the adapter returns constraint error related to the id
How to reproduce
Set up the .env.local with the appropriate variables from FaunaDB and google OAuth app and run the application
Adapter type
@auth/fauna-adapter
Environment
System: OS: macOS 14.5 CPU: (8) arm64 Apple M2 Memory: 137.31 MB / 8.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.12.1 - ~/.nvm/versions/node/v20.12.1/bin/node npm: 10.5.0 - ~/.nvm/versions/node/v20.12.1/bin/npm Browsers: Safari: 17.5 npmPackages: @auth/fauna-adapter: ^3.7.3 => 3.7.3 next: 15.0.3 => 15.0.3 next-auth: ^5.0.0-beta.25 => 5.0.0-beta.25 react: 19.0.0-rc-66855b96-20241106 => 19.0.0-rc-66855b96-20241106
Reproduction URL
https://github.com/SB17Codes/faunaadapter-error.git
Describe the issue
I'm developing a web application using Next.js and implementing an authentication system with NextAuth.js and FaunaDB through the Fauna adapter. Despite following the official documentation for both NextAuth and the Fauna adapter, I'm encountering a critical error during the user authentication process.
I've followed the documentation for the FaunaAdapter to the letter created the schemas for the necessary tables as indicated but after trying to debug the issue using the Fauna Dashboard I noticed that the id field is a reserved field in fauna but still we could create User documents using custom ids that we provide up to a certain length and then it would give us the following error:
and since the id that the social providers return is usually a too long the create_User function from the adapter returns constraint error related to the id
How to reproduce
Set up the .env.local with the appropriate variables from FaunaDB and google OAuth app and run the application
Expected behavior
Create a User in the fauna database