Skip to content
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 adapter (issues and updated default jwt encoding) #11338

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

adriangalilea
Copy link

@adriangalilea adriangalilea commented Jul 5, 2024

☕️ Reasoning

Dgraph adapter is outdated in several ways:

JWT session and @auth directive

Dgraph only works with HS256 or RS256 algorithms.

This is no longer true so I updated the client and the docs, to favor HS512 as default to match next-auth and simplify, there's no need for custom encoding/decoding nor that section of the docs, respected backwards compatibility, and documented both in code and in the .mdx

DgraphClientError: unknown field error

Current adapter docs used ID while injecting next-auth generated id but Dgraph ID means internally generated ID, so I modified the adapter so that it respects the internal Dgraph ID's rather than using next-auth generated ones. I believe this is the right way, but I also added a warning on the docs a warning about this behaviour and how to opt-out.

General rework

I may not be the best typescript programmer, but for instance, every adapter method used any, and also removed boilerplate. I'm not sure if all the changes are good and would love for someone to review it.

I've tested:

  • creating an user
  • sign-in and sign-out

I think many of the code is redundant, things like createSession never seem to trigger, and I guess that's due using jwt always in order for the authz in Dgraph to work. So maybe all that code can be removed and the decision documented.

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Fixes: #11273
#10719

📌 Resources

Copy link

vercel bot commented Jul 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 7, 2024 11:39am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Jul 7, 2024 11:39am
Copy link

vercel bot commented Jul 5, 2024

@adriangalilea is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added adapters Changes related to the core code concerning database adapters dgraph @auth/dgraph-adapter labels Jul 5, 2024
@adriangalilea
Copy link
Author

adriangalilea commented Jul 7, 2024

While my manual testing works properly with the next-auth example repo and user creation sign-in and sign-out. I've been trying to update the testing methodology currently present for Dgraph, seems like nothing was working so I don't know what to compare it to, see results:

https://github.com/nextauthjs/next-auth/blob/1bd4dd8316e33d14636e5345fc24e4ef380f4789/packages/adapter-dgraph/test/test.sh

❯ pnpm test --filter @auth/dgraph-adapter

.                                        |  WARN  Unsupported engine: wanted: {"node":"^18.18.0 || ^20.8.0"} (current: {"node":"v22.1.0","pnpm":"8.6.7"})

> @auth/dgraph-adapter@2.4.1 test /Users/adrian/Developer/next-auth/packages/adapter-dgraph
> ./test/test.sh

f9b6971a889090a83a0bac1d757cba6b9be5ed9ea93d1fb2477c5af866dd5a1f
Waiting 15s for db to start...
head: illegal line count -- -1
{"errors":[{"message":"resolving updateGQLSchema failed because input: No query or mutation found in the generated schema (Locations: [{Line: 3, Column: 4}])","extensions":{"code":"Error"}}]}
Waiting 5s for schema to be uploaded...
 RUN  v1.2.2 /Users/adrian/Developer/next-auth/packages/adapter-dgraph
      Coverage enabled with v8

 ❯ test/index.test.ts (0)

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 FAIL  test/index.test.ts [ test/index.test.ts ]
Error: Failed to load url @auth/core/adapters (resolved id: @auth/core/adapters) in /Users/adrian/Developer/next-auth/packages/adapter-dgraph/src/index.ts. Does the file exist?
 ❯ loadAndTransform ../../node_modules/.pnpm/vite@5.2.10_@types+node@20.12.7/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:53878:21

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

 Test Files  1 failed (1)
      Tests  no tests
   Start at  13:28:14
   Duration  175ms (transform 26ms, setup 5ms, collect 0ms, tests 0ms, environment 0ms, prepare 42ms)

I've reworked the script logic and update the tests to use HS512 (and included the new key), while I can't make it work fully, the whole test.sh script is way more robust and clean, if anyone can point me in the right direction on what could be going wrong, I'd appreciate @ndom91 @ubbe-xyz

My results currently are:

❯ pnpm test --filter @auth/dgraph-adapter

.                                        |  WARN  Unsupported engine: wanted: {"node":"^18.18.0 || ^20.8.0"} (current: {"node":"v22.1.0","pnpm":"8.6.7"})

> @auth/dgraph-adapter@2.4.1 test /Users/adrian/Developer/next-auth/packages/adapter-dgraph
> ./test/test.sh

----------------------------------------
Starting Dgraph container...
4e2bdc9f05bcc5aa361af04c01d85c0027c05ed98dd1f3ef1cc09151415e5e21
----------------------------------------
Dgraph not up... attempt 1
Dgraph not up... attempt 2
Dgraph not up... attempt 3
Dgraph is up!
200Schema has been successfully uploaded.

 RUN  v1.2.2 /Users/adrian/Developer/next-auth/packages/adapter-dgraph
      Coverage enabled with v8

stdout | test/index.test.ts:15:11
Loaded JWT secret from file GnaXu1rdxsquR+3y17VWU+/o4rs+URBZJqQwEizWLec=


stderr | test/index.test.ts > createUser
Error executing GraphQL query: DgraphClientError: GraphQL query failed with 2 errors. {
  query: '\n' +
    '          mutation ($input: [AddUserInput!]!) {\n' +
    '            addUser(input: $input) {\n' +
    '              user {\n' +
    '                ...UserFragment\n' +
    '              }\n' +
    '            }\n' +
    '          }\n' +
    '          \n' +
    '  fragment UserFragment on User {\n' +
    '    email\n' +
    '    id\n' +
    '    image\n' +
    '    name\n' +
    '    emailVerified\n' +
    '  }\n' +
    '\n' +
    '        ',
  variables: { input: [ [Object] ] }
}

stderr | test/index.test.ts > getUser
Error executing GraphQL query: DgraphClientError: GraphQL query failed with 1 errors. {
  query: '\n' +
    '          query ($id: ID!) {\n' +
    '            getUser(id: $id) {\n' +
    '              ...UserFragment\n' +
    '            }\n' +
    '          }\n' +
    '          \n' +
    '  fragment UserFragment on User {\n' +
    '    email\n' +
    '    id\n' +
    '    image\n' +
    '    name\n' +
    '    emailVerified\n' +
    '  }\n' +
    '\n' +
    '        ',
  variables: { id: '0x0a0a00a00' }
}

stderr | test/index.test.ts > getUserByEmail
Error executing GraphQL query: DgraphClientError: GraphQL query failed with 1 errors. {
  query: '\n' +
    '          query ($email: String!) {\n' +
    '            queryUser(filter: { email: { eq: $email } }) {\n' +
    '              ...UserFragment\n' +
    '            }\n' +
    '          }\n' +
    '          \n' +
    '  fragment UserFragment on User {\n' +
    '    email\n' +
    '    id\n' +
    '    image\n' +
    '    name\n' +
    '    emailVerified\n' +
    '  }\n' +
    '\n' +
    '        ',
  variables: { email: 'non-existent-email' }
}

stderr | test/index.test.ts > getSessionAndUser
Error executing GraphQL query: DgraphClientError: GraphQL quer...

...
       |                 ^
     97|         }
     98| 
 ❯ Object.createVerificationToken src/index.ts:362:22
 ❯ ../utils/adapter.ts:271:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { query: '\n          mutation CreateVerificationToken(\n            $input: [AddVerificationTokenInput!]!\n          ) {\n            addVerificationToken(input: $input) {\n              verificationToken {\n                identifier\n                token\n                expires\n              }\n            }\n          }\n        ', variables: { input: [ { token: '9e732db472465eb941dfe7a71fbc5f7f4c7e169b406a49299d4a1203bf55d29d', identifier: 'info@example.com', expires: { constructor: 'Function<Date>', toString: 'Function<toString>', toDateString: 'Function<toDateString>', toTimeString: 'Function<toTimeString>', toISOString: 'Function<toISOString>', toUTCString: 'Function<toUTCString>', toGMTString: 'Function<toUTCString>', getDate: 'Function<getDate>', setDate: 'Function<setDate>', getDay: 'Function<getDay>', getFullYear: 'Function<getFullYear>', setFullYear: 'Function<setFullYear>', getHours: 'Function<getHours>', setHours: 'Function<setHours>', getMilliseconds: 'Function<getMilliseconds>', setMilliseconds: 'Function<setMilliseconds>', getMinutes: 'Function<getMinutes>', setMinutes: 'Function<setMinutes>', getMonth: 'Function<getMonth>', setMonth: 'Function<setMonth>', getSeconds: 'Function<getSeconds>', setSeconds: 'Function<setSeconds>', getTime: 'Function<getTime>', setTime: 'Function<setTime>', getTimezoneOffset: 'Function<getTimezoneOffset>', getUTCDate: 'Function<getUTCDate>', setUTCDate: 'Function<setUTCDate>', getUTCDay: 'Function<getUTCDay>', getUTCFullYear: 'Function<getUTCFullYear>', setUTCFullYear: 'Function<setUTCFullYear>', getUTCHours: 'Function<getUTCHours>', setUTCHours: 'Function<setUTCHours>', getUTCMilliseconds: 'Function<getUTCMilliseconds>', setUTCMilliseconds: 'Function<setUTCMilliseconds>', getUTCMinutes: 'Function<getUTCMinutes>', setUTCMinutes: 'Function<setUTCMinutes>', getUTCMonth: 'Function<getUTCMonth>', setUTCMonth: 'Function<setUTCMonth>', getUTCSeconds: 'Function<getUTCSeconds>', setUTCSeconds: 'Function<setUTCSeconds>', valueOf: 'Function<valueOf>', getYear: 'Function<getYear>', setYear: 'Function<setYear>', toJSON: 'Function<toJSON>', toLocaleString: 'Function<toLocaleString>', toLocaleDateString: 'Function<toLocaleDateString>', toLocaleTimeString: 'Function<toLocaleTimeString>' } } ] }, originalErrors: [ { message: 'Unknown type "AddVerificationTokenInput".', locations: [ { line: 2, column: 11 } ] } ] }
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[13/16]⎯

 FAIL  test/index.test.ts > useVerificationToken
DgraphClientError: GraphQL query failed with 1 errors.
 ❯ Object.run src/lib/client.ts:96:17
     94|         const { data = {}, errors } = await response.json()
     95|         if (errors?.length) {
     96|           throw new DgraphClientError(errors, query, variables)
       |                 ^
     97|         }
     98| 
 ❯ Object.createVerificationToken src/index.ts:362:22
 ❯ ../utils/adapter.ts:291:5

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { query: '\n          mutation CreateVerificationToken(\n            $input: [AddVerificationTokenInput!]!\n          ) {\n            addVerificationToken(input: $input) {\n              verificationToken {\n                identifier\n                token\n                expires\n              }\n            }\n          }\n        ', variables: { input: [ { token: '9e732db472465eb941dfe7a71fbc5f7f4c7e169b406a49299d4a1203bf55d29d', identifier: 'info@example.com', expires: { constructor: 'Function<Date>', toString: 'Function<toString>', toDateString: 'Function<toDateString>', toTimeString: 'Function<toTimeString>', toISOString: 'Function<toISOString>', toUTCString: 'Function<toUTCString>', toGMTString: 'Function<toUTCString>', getDate: 'Function<getDate>', setDate: 'Function<setDate>', getDay: 'Function<getDay>', getFullYear: 'Function<getFullYear>', setFullYear: 'Function<setFullYear>', getHours: 'Function<getHours>', setHours: 'Function<setHours>', getMilliseconds: 'Function<getMilliseconds>', setMilliseconds: 'Function<setMilliseconds>', getMinutes: 'Function<getMinutes>', setMinutes: 'Function<setMinutes>', getMonth: 'Function<getMonth>', setMonth: 'Function<setMonth>', getSeconds: 'Function<getSeconds>', setSeconds: 'Function<setSeconds>', getTime: 'Function<getTime>', setTime: 'Function<setTime>', getTimezoneOffset: 'Function<getTimezoneOffset>', getUTCDate: 'Function<getUTCDate>', setUTCDate: 'Function<setUTCDate>', getUTCDay: 'Function<getUTCDay>', getUTCFullYear: 'Function<getUTCFullYear>', setUTCFullYear: 'Function<setUTCFullYear>', getUTCHours: 'Function<getUTCHours>', setUTCHours: 'Function<setUTCHours>', getUTCMilliseconds: 'Function<getUTCMilliseconds>', setUTCMilliseconds: 'Function<setUTCMilliseconds>', getUTCMinutes: 'Function<getUTCMinutes>', setUTCMinutes: 'Function<setUTCMinutes>', getUTCMonth: 'Function<getUTCMonth>', setUTCMonth: 'Function<setUTCMonth>', getUTCSeconds: 'Function<getUTCSeconds>', setUTCSeconds: 'Function<setUTCSeconds>', valueOf: 'Function<valueOf>', getYear: 'Function<getYear>', setYear: 'Function<setYear>', toJSON: 'Function<toJSON>', toLocaleString: 'Function<toLocaleString>', toLocaleDateString: 'Function<toLocaleDateString>', toLocaleTimeString: 'Function<toLocaleTimeString>' } } ] }, originalErrors: [ { message: 'Unknown type "AddVerificationTokenInput".', locations: [ { line: 2, column: 11 } ] } ] }
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[14/16]⎯

 FAIL  test/index.test.ts > unlinkAccount
DgraphClientError: GraphQL query failed with 1 errors.
 ❯ Object.run src/lib/client.ts:96:17
     94|         const { data = {}, errors } = await response.json()
     95|         if (errors?.length) {
     96|           throw new DgraphClientError(errors, query, variables)
       |                 ^
     97|         }
     98| 
 ❯ Object.account test/index.test.ts:89:22
 ❯ ../utils/adapter.ts:322:21

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { query: '\n          query ($providerAccountId: String = "", $provider: String = "") {\n            queryAccount(\n              filter: {\n                providerAccountId: { eq: $providerAccountId }\n                provider: { eq: $provider }\n              }\n            ) {\n              ...AccountFragment\n              user {\n                id\n              }\n            }\n          }\n          \n  fragment AccountFragment on Account {\n    id\n    type\n    provider\n    providerAccountId\n    expires_at\n    token_type\n    scope\n    access_token\n    refresh_token\n    id_token\n    session_state\n  }\n\n        ', variables: { provider: 'github', providerAccountId: '0x0a0a00a00' }, originalErrors: [ { message: 'Unknown type "Account".', locations: [ { line: 16, column: 3 } ] } ] }
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[15/16]⎯

 FAIL  test/index.test.ts > deleteUser
DgraphClientError: GraphQL query failed with 1 errors.
 ❯ Object.run src/lib/client.ts:96:17
     94|         const { data = {}, errors } = await response.json()
     95|         if (errors?.length) {
     96|           throw new DgraphClientError(errors, query, variables)
       |                 ^
     97|         }
     98| 
 ❯ Object.user test/index.test.ts:54:22
 ❯ ../utils/adapter.ts:340:18

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { query: '\n          query ($id: ID!) {\n            getUser(id: $id) {\n              ...UserFragment\n            }\n          }\n          \n  fragment UserFragment on User {\n    email\n    id\n    image\n    name\n    emailVerified\n  }\n\n        ', variables: { id: '0x0a0a00a00' }, originalErrors: [ { message: 'Unknown type "User".', locations: [ { line: 8, column: 3 } ] } ] }
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[16/16]⎯

 Test Files  1 failed (1)
      Tests  15 failed | 2 passed | 5 skipped (22)
   Start at  13:36:01
   Duration  3.80s (transform 68ms, setup 30ms, collect 63ms, tests 3.56s, environment 0ms, prepare 44ms)

Tests failed.
----------------------------------------
Stopping Dgraph container...
authjs-dgraph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters dgraph @auth/dgraph-adapter
1 participant