{"record":{"id":"1db99f911997a98a","repo":"toeverything/AFFiNE","slug":"invalid-turnstile-configuration","errorCode":null,"errorMessage":"Invalid Turnstile configuration","messagePattern":"Invalid Turnstile configuration","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/cloud/services/captcha.ts","lineNumber":55,"sourceCode":"  revalidate = effect(\n    exhaustMap(() => {\n      return fromPromise(async signal => {\n        if (!this.needCaptcha$.value) {\n          return {};\n        }\n        const res = await this.fetchService.fetch('/api/auth/captcha', {\n          signal,\n        });\n        const data = (await res.json()) as {\n          provider: 'hashcash' | 'turnstile';\n          challenge?: string;\n          resource?: string;\n          siteKey?: string;\n          action?: string;\n        };\n        if (data.provider === 'turnstile') {\n          if (!data.siteKey || !data.action) {\n            throw new Error('Invalid Turnstile configuration');\n          }\n          return {\n            provider: data.provider,\n            turnstile: { siteKey: data.siteKey, action: data.action },\n          };\n        }\n        if (\n          data.provider !== 'hashcash' ||\n          !data.challenge ||\n          !data.resource ||\n          !this.validatorProvider\n        ) {\n          throw new Error('Invalid Hashcash challenge');\n        }\n        const token = await this.validatorProvider.validate(\n          data.challenge,\n          data.resource\n        );","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/cloud/services/captcha.ts#L37-L73","documentation":"Thrown in CaptchaService's revalidate effect when the /api/auth/captcha response declares provider 'turnstile' but omits siteKey or action, meaning the server's captcha configuration is incomplete and a Turnstile challenge cannot be rendered.","triggerScenarios":"Thrown in the captcha service revalidate effect when the server reports the turnstile provider but omits siteKey or action in the /api/auth/captcha response.","commonSituations":"Occurs against a misconfigured self-hosted server with incomplete Turnstile settings. Fix the server's captcha configuration and retry sign-in.","solutions":["Provide a valid Turnstile site key in the server configuration.","Disable Turnstile captcha if it is not configured."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}