I’ve set up Next-Auth on my NextJS project to use FaunaDB. I’ve managed to get it working on my production environment, however, it seems to not be working on my development environment, which is using the Fauna Dev docker container rather than the cloud-based database.
Whenever I run the dev server, I get an error log containing the following;
https://next-auth.js.org/errors#fauna__get_session_error [NotFound: instance not found] {
description: 'Set not found.',
The full log is in the original SO post.
I’ve followed the guide to set this up and continue to get the same error. I’ve removed and recreated the fauna docker container several times, still the same error. I also have some data that I can access in the local Fauna Dev database, so that seems to be set up fine. Also if I change my .env.local environment variables to the ones I use on production, it all works fine, but of course is then using the cloud database.
I was also asked to post the output for Paginate(Match(Index("session_by_token"), "<a valid token id>")). I don’t have a valid ID to run as the collection is empty on my Fauna Dev image, but if I copy/paste the above I get the following;
{ data: [] }
So it seems to me that the index is correctly set up, as it’s not throwing an error.
I’ve been trying to work this out for days, so any assistance would be greatly appreciated. Many thanks!
Just to make sure we’re covering all the possibilities, can you add a dummy session token to the collection and then run the Paginate(Match(Index("session_by_token"))) query again?
Looking at the log, the original error was a 404 on this query:
But if the collection is empty then a 404 for a Get() based on that term seems appropriate. Adding some dummy data and testing against that will help narrow down what’s happening.
I tried running the code again and it came up with the exact same error, including the value for "terms:" you quoted. However, I also did a search in the console for the session token I created and it found that.
My apologies for not responding, I’ve been busy over the last week.
I was just going to run through it all again to give you the details, but I upgraded to the latest version 3 of next-auth and it seems to be working. Feel free to close the thread and I’ll reopen if I start running into the same issue again.