-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
fix(dgraph): id generation overlap #10719
base: main
Are you sure you want to change the base?
Conversation
Dgraph will generate the ID by itself. In Dgraph, every node has a unique 64-bit identifier that you can expose in GraphQL using the ID type. An ID is auto-generated, immutable and never reused. Each type can have at most one ID field. The ID type works great when you need to use an identifier on nodes and don’t need to set that identifier externally
fix dgraph adapter createUser
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Just curious why the current tests pass and why this isn't necessary for |
@ndom91 Sorry, I didn't see your comment in this thread without mention.
The test uses a predefined id value next-auth/packages/adapter-dgraph/test/index.test.ts Lines 22 to 43 in 770112c
And in reality, the random UUID is invalid, it doesn't match the DGraph UID conditions. Situation similar to the FaunaDB adapter next-auth/packages/adapter-fauna/test/index.test.ts Lines 17 to 26 in 770112c
And I think maybe |
I spent several hours trying to get the dgraph adapter to work on next-auth only to realize that: I tried discussing on the forum but seems dead. What's the status of this PR? I've noticed Dgraph adapter and Dgraph adapter docs are outdated in several ways: Dgraph now allows HS512 so this is wrong now on the dgraph adapter docs. Also I faced some edge runtime issues when trying to call Can we make this PR cover all graph adapter fixes so it's easier to track? @korzhanov |
@adriangalilea same story bro. I would like this PR to at least allow correct user creation. I don't have much hope for the rest - I'll have to find solutions on my own :( Maybe @ndom91, @beynar or @balazsorban44 will help us |
@korzhanov I created a issue with a repro repo now so it stays open and let's us track it, I also reached out to the Dgraph team both on the forum(which seems dead) and their support, who replied previously so hopefully they can chime in as I pointed out both the the Github issue and this very PR. |
Hey @korzhanov I fixed: edge runtime issues, which seems to be not related to dgraph. The JWT algo encoding is outdated and should be ideally updated so that it uses the same that next-auth uses by default, so overall would be simpler, and docs can be trimmed down too, this part should be removed. Check it out if you wish, I think we can fix it fully, I may be able to also sort the documentation too, would love someone from the Dgraph team to chime in as I mentioned. @korzhanov Do you want me to create a new PR so I cover all the mentioned issues, or do you prefer to update this one together? |
☕️ Reasoning
Dgraph will generate the ID by itself. In Dgraph, every node has a unique 64-bit identifier that you can expose in GraphQL using the ID type. An ID is auto-generated, immutable and never reused. Each type can have at most one ID field.
The ID type works great when you need to use an identifier on nodes and don’t need to set that identifier externally
DGraph type docs
Since next-auth.js or auth.js creates a new user id, this causes an error and does not save the entry to dgraph
🧢 Checklist
🎫 Affected issues
📌 Resources