toeverything/AFFiNE · error · Error

Invalid Turnstile configuration

Error message

Invalid Turnstile configuration

What it means

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.

Source

Thrown at packages/frontend/core/src/modules/cloud/services/captcha.ts:55

  revalidate = effect(
    exhaustMap(() => {
      return fromPromise(async signal => {
        if (!this.needCaptcha$.value) {
          return {};
        }
        const res = await this.fetchService.fetch('/api/auth/captcha', {
          signal,
        });
        const data = (await res.json()) as {
          provider: 'hashcash' | 'turnstile';
          challenge?: string;
          resource?: string;
          siteKey?: string;
          action?: string;
        };
        if (data.provider === 'turnstile') {
          if (!data.siteKey || !data.action) {
            throw new Error('Invalid Turnstile configuration');
          }
          return {
            provider: data.provider,
            turnstile: { siteKey: data.siteKey, action: data.action },
          };
        }
        if (
          data.provider !== 'hashcash' ||
          !data.challenge ||
          !data.resource ||
          !this.validatorProvider
        ) {
          throw new Error('Invalid Hashcash challenge');
        }
        const token = await this.validatorProvider.validate(
          data.challenge,
          data.resource
        );

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Provide a valid Turnstile site key in the server configuration.
  2. Disable Turnstile captcha if it is not configured.
Defensive patterns

Strategy: validation

When it happens

Trigger: 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.

Common situations: Occurs against a misconfigured self-hosted server with incomplete Turnstile settings. Fix the server's captcha configuration and retry sign-in.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/1db99f911997a98a. Report an issue: GitHub.