{"record":{"id":"1aabf385efdc8d15","repo":"nextauthjs/next-auth","slug":"verification-token-not-created","errorCode":null,"errorMessage":"Verification Token not created","messagePattern":"Verification Token not created","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapter-surrealdb/src/index.ts","lineNumber":442,"sourceCode":"    async createVerificationToken(verificationToken: VerificationToken) {\n      try {\n        const surreal = await client\n        const doc = verificationTokenToDoc(verificationToken)\n\n        const verificationTokenDocs = await surreal.create<\n          VerificationTokenDoc,\n          Omit<VerificationTokenDoc, \"id\">\n        >(\"verification_token\", doc)\n        if (verificationTokenDocs.length) {\n          const verificationTokenDoc: Partial<VerificationTokenDoc> =\n            verificationTokenDocs[0]\n          if (verificationTokenDoc.id) delete verificationTokenDoc.id\n          return docToVerificationToken(\n            verificationTokenDoc as VerificationTokenDoc\n          )\n        }\n      } catch {}\n      throw new Error(\"Verification Token not created\")\n    },\n    async useVerificationToken({\n      identifier,\n      token,\n    }: {\n      identifier: string\n      token: string\n    }) {\n      const surreal = await client\n      try {\n        const [tokens] = await surreal.query<[VerificationTokenDoc[]]>(\n          `SELECT * FROM verification_token WHERE identifier = $identifier AND token = $vt LIMIT 1`,\n          { identifier, vt: token }\n        )\n        if (tokens.length && tokens.at(0)) {\n          const vt = tokens[0]\n          if (vt) {\n            await surreal.delete(vt.id)","sourceCodeStart":424,"sourceCodeEnd":460,"githubUrl":"https://github.com/nextauthjs/next-auth/blob/a1a16a5a7780488c7449feece410033f445d0b31/packages/adapter-surrealdb/src/index.ts#L424-L460","documentation":"createVerificationToken() stores an email verification / magic-link token. If the SurrealDB create fails or returns an empty result, the adapter throws 'Verification Token not created' after swallowing the underlying error.","triggerScenarios":"surreal.create('verification_token', ...) throws (connection/permission/schema) or returns an empty array; malformed token payload fields (identifier/token/expires) after userToDoc-style conversion.","commonSituations":"Email magic-link or email-verification flows failing at sign-in; SurrealDB table missing because migrations were never run; adapter lacking CREATE permission on the verification token table.","solutions":["Confirm the verification token table exists and the adapter credentials can create rows in it","Verify SurrealDB connection env vars (URL, namespace, database, auth) are correct","Log inside the try to reveal the suppressed root error","Check that identifier/token/expires values passed by the core are valid (non-null, correct types)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!identifier || !token || !(expires instanceof Date)) {\n  throw new Error('Invalid verification token payload')\n}\nawait adapter.createVerificationToken({ identifier, token, expires })","typeGuard":null,"tryCatchPattern":"try {\n  return await adapter.createVerificationToken(params)\n} catch (e) {\n  if (e.message === 'Verification Token not created') {\n    console.error('Token creation failed — check SurrealDB table/permissions', e)\n  }\n  throw e\n}","preventionTips":["Ensure the verification_token table exists before first sign-in","Keep SurrealDB auth env vars consistent across environments","Log adapter errors; the empty catch hides root causes"],"tags":["adapter","verification-token","surrealdb"],"backgroundTag":"adapter-write-failed","analyzedSha":"a1a16a5a7780488c7449feece410033f445d0b31","analyzedAt":"2026-08-28T21:52:38.200Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}