Commit dd09d38
fix(clerk-js): Add retry logic and race condition fixes for Cloudflare captcha error 200100
This fixes Cloudflare Turnstile error 200100 ("Widget not found") which occurs when the captcha container element isn't available during rendering.
Changes:
- Add '200' to shouldRetryTurnstileErrorCode to retry all 200xxx errors (including 200100)
- Add waitForElement() call before captcha.render() to verify container exists
- Update smart widget initialization to use waitForElement() instead of getElementById()
- Add test coverage for error codes 200, 200100, and 200xxx
These changes prevent race conditions where DOM elements are removed or not ready between checks and render calls, particularly during React/framework re-renders.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent aa2d3b5 commit dd09d38
2 files changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | | - | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
| 121 | + | |
121 | 122 | | |
122 | 123 | | |
123 | 124 | | |
| |||
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | | - | |
| 151 | + | |
151 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
152 | 160 | | |
153 | 161 | | |
154 | 162 | | |
| |||
0 commit comments