Skip to content

fix(clerk-js): Use stable DOM container for smart captcha to prevent 200100 errors#7767

Closed
jacekradko wants to merge 1 commit intomainfrom
fix-captcha-stable-container
Closed

fix(clerk-js): Use stable DOM container for smart captcha to prevent 200100 errors#7767
jacekradko wants to merge 1 commit intomainfrom
fix-captcha-stable-container

Conversation

@jacekradko
Copy link
Member

Summary

This PR is a proposed fix for Cloudflare Turnstile 200100 "Widget not found" errors that may occur when React re-renders remove the captcha container element during verification.

Note: This is a hypothesis that needs testing. The fix targets a suspected race condition but has not yet been validated in production.

Problem (Hypothesis)

When using the "smart" widget type, Turnstile renders into a React-managed DOM element (#clerk-captcha). If React re-renders during the verification process (e.g., due to form state changes), the element could be unmounted and remounted, causing Turnstile to lose track of its widget and throw error 200100.

Suspected behavior:

  • User submits form
  • Captcha widget appears and user interacts with it
  • "Verifying..." appears
  • React re-render removes/replaces the container element
  • Turnstile can't find its widget → 200100 error

Proposed Solution

Create a stable DOM container outside React's control for the smart widget:

  1. When smart widget is requested, find the React #clerk-captcha element
  2. Create a new #clerk-captcha-stable div imperatively (not managed by React)
  3. Insert it next to the React element and hide the React element
  4. Render Turnstile into the stable container
  5. On completion (success or failure), remove the stable container and restore the React element

This approach mirrors how the "invisible" widget already works—it creates its own container on document.body that isn't affected by React re-renders.

Testing Required

  • Test with smart widget type on signup flow
  • Verify widget appears and verification completes successfully
  • Verify cleanup restores original React element visibility
  • Test error scenarios (network failure, invalid response)
  • Validate this actually addresses the 200100 errors seen in production

…revent 200100 errors during React re-renders
@vercel
Copy link

vercel bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 4, 2026 8:56pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 4, 2026

⚠️ No Changeset found

Latest commit: 2ba076a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jacekradko jacekradko requested review from anagstef and nikosdouvlis and removed request for anagstef February 4, 2026 20:58
@jacekradko jacekradko closed this Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant