Skip to content

fix: 2FA Server Key setup — error toast and QR code fails to load on iOS#6941

Draft
Copilot wants to merge 3 commits into
feat/openspec-integrationfrom
copilot/fix-2fa-setup-server-key-error
Draft

fix: 2FA Server Key setup — error toast and QR code fails to load on iOS#6941
Copilot wants to merge 3 commits into
feat/openspec-integrationfrom
copilot/fix-2fa-setup-server-key-error

Conversation

Copy link
Copy Markdown

Copilot AI commented May 7, 2026

On iOS, navigating to "Set up 2FA for Server Key" threw Cannot read properties of undefined (reading 'model'), left the screen permanently spinning, and sometimes rendered only the manual key with no QR code.

Root causes

  • SigningServer.ts — silent error swallowing (13 methods): The two-branch catch pattern skipped rethrowing when err had neither .response nor .code (network timeout, SSL failure on iOS). res stayed undefined; the next res.data access produced a secondary TypeError whose property name varied by path ("model", "data", etc.).

    // Before — silently falls through when neither branch matches
    } catch (err) {
      if (err.response) throw new Error(err.response.data.err);
      if (err.code)     throw new Error(err.code);
    }
    
    // After — always throws a meaningful message
    } catch (err) {
      throw new Error(err.response?.data?.err || err.code || err.message || err.toString());
    }
  • SetupSigningServer.tsx — unsafe access + wrong guard: setupData.verification.verifier threw on malformed server responses; validationKey === '' didn't catch undefined/null, allowing QR render with a falsy key.

  • No error recovery UX: A failed registration left the screen stuck in a permanent spinner with no path to retry.

  • KeeperQRCode — no render-error escape hatch: react-native-qrcode-svg accepts onError; without it, generation failures in the component's useMemo were rethrown uncaught.

Changes

  • SigningServer.ts — applied safe rethrow to all 13 axios catch blocks.
  • KeeperQRCode.tsx — added optional onError?: (error: Error) => void prop, forwarded directly to <QRCode>.
  • SetupSigningServer.tsx
    • Guard: validationKey === ''!validationKey
    • Safe access: setupData?.verification?.verifier; explicit registrationError state set when verifier is missing
    • Error state: replaces spinner with a Retry button on failure; onError on <KeeperQRCode> surfaces render failures as a toast
  • SetupAdditionalServerKey.tsx — same !validationKey guard for parity.

Copilot AI changed the title [WIP] Fix 2FA setup for Server Key error toast and QR code issues fix: 2FA Server Key setup — error toast and QR code fails to load on iOS May 7, 2026
Copilot finished work on behalf of Parsh May 7, 2026 11:38
Copilot AI requested a review from Parsh May 7, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2FA setup for Server Key shows error toast and QR code fails to load(ios)

2 participants