fix(adapter): transistion to surrealdb@^1.0.0#11911
fix(adapter): transistion to surrealdb@^1.0.0#11911ThangHuuVu merged 31 commits intonextauthjs:mainfrom dvanmali:main
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
|
@dvanmali is attempting to deploy a commit to the authjs Team on Vercel. A member of the Team first needs to authorize it. |
…exponential backoff for disconnection events to example
|
Any updates on this PR? Would love to see it merged so we can use SurrealDB with Auth.js! |
|
Sure @ThangHuuVu, just updated the lockfile and fixed the shell script so it can now pass your test scripts. It appears that Surrealdb v3-alpha is currently tied to latest so it may not currently be compatible as they mention on their javascript library. |
|
Feel free to message this thread again if you wish for another update or add a PR or issue to my main. Unfortunately because I don't have write access to this repo, i can't make a branch here, hence the forked repo from main |
|
Were you able to take a look @ThangHuuVu? |
|
@dvanmali just approved the jobs but the build is failing, could u help check it? 🙏 |
|
Gtg @ThangHuuVu 👍 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11911 +/- ##
==========================================
+ Coverage 39.19% 39.43% +0.23%
==========================================
Files 200 200
Lines 31615 31756 +141
Branches 1381 1399 +18
==========================================
+ Hits 12391 12522 +131
- Misses 19224 19234 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@ndom91 @balazsorban44 @ThangHuuVu Vercel keeps blocking the build with "authorization required to deploy" |
|
I merged, thanks for your consistent effort @dvanmali |
|
Love it! Thank you @ThangHuuVu |
| return docToUser(userDoc[0]) | ||
| } | ||
| } catch {} | ||
| throw new Error("User not created") |
There was a problem hiding this comment.
@dvanmali Finally getting around to try out your changes and noticed something and had a suggestion. this error always gets thrown. If you have time it would also be great if you could use the logger to log the errors being caught as well.
There was a problem hiding this comment.
If you don't have time I don't mind submitting a PR, it would just be easier to continue this one.
There was a problem hiding this comment.
Could you submit a PR? This one got merged so a new PR would be needed anyways. Feel free to tag me if you need assistance
There was a problem hiding this comment.
Will do, I should have some time tonight or tomorrow. Thanks!
There was a problem hiding this comment.
I missed the return just above, so it turns out the error doesn't always get thrown. I looked into the logger, and I guess it's not easily accessible. Some better logging would be helpful though, but perhaps that's more on AuthJS side as a stacktrace doesn't even get logged.
|
@dvanmali Can you provide SurrealQL code to setup schemafull tables? Here's what I have so far. // User table
DEFINE TABLE user SCHEMAFULL;
DEFINE FIELD email ON user TYPE string ASSERT string::is::email($value);
DEFINE FIELD password ON user TYPE option<string>;
DEFINE FIELD name ON user TYPE string;
DEFINE FIELD image ON user TYPE option<string>;
DEFINE FIELD created_at ON user TYPE datetime DEFAULT time::now();
DEFINE FIELD updated_at ON user TYPE datetime DEFAULT time::now();
DEFINE FIELD last_login ON user TYPE datetime DEFAULT time::now();
DEFINE INDEX email_idx ON user COLUMNS email UNIQUE;
// Session table
DEFINE TABLE session SCHEMAFULL;
DEFINE FIELD userId ON session TYPE record<user>;
DEFINE FIELD expires ON session TYPE datetime;
DEFINE FIELD sessionToken ON session TYPE string;
DEFINE INDEX session_token_idx ON session COLUMNS sessionToken UNIQUE;
// Account table
DEFINE TABLE account SCHEMAFULL;
DEFINE FIELD userId ON account TYPE record<user>;
DEFINE FIELD type ON account TYPE string;
DEFINE FIELD provider ON account TYPE string;
DEFINE FIELD providerAccountId ON account TYPE string;
DEFINE FIELD refresh_token ON account TYPE option<string>;
DEFINE FIELD access_token ON account TYPE string;
DEFINE FIELD expires_at ON account TYPE int;
DEFINE FIELD token_type ON account TYPE string;
DEFINE FIELD scope ON account TYPE string;
DEFINE FIELD id_token ON account TYPE string;
DEFINE FIELD session_state ON account TYPE option<string>;
DEFINE INDEX provider_account_idx ON account COLUMNS provider, providerAccountId UNIQUE;
// VerificationToken table
DEFINE TABLE verification_token SCHEMAFULL;
DEFINE FIELD identifier ON verification_token TYPE string;
DEFINE FIELD token ON verification_token TYPE string;
DEFINE FIELD expires ON verification_token TYPE datetime;
DEFINE INDEX verification_token_idx ON verification_token COLUMNS token UNIQUE;
DEFINE INDEX verification_identifier_token_idx ON verification_token COLUMNS identifier, token UNIQUE; |
☕️ Reasoning
Moves package dependency to version 1 of the surrealdb javascript library. Package includes websocket connectivity, type safety, updates to the setup documentation, and package peer dependency change.
🧢 Checklist
🎫 Affected issues
#11732 - solves this by transistioning to surrealdb@v1.0.0 package. Docs state to use new connection string.
#11866 - javascript package supports surrealdb v2
#11471 - uses current surrealdb software
📌 Resources