Skip to content

Commit

Permalink
fix(clerk-js): Better CAPTCHA widget console error (#3989)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefanos Anagnostou <[email protected]>
  • Loading branch information
agis and anagstef authored Aug 20, 2024
1 parent ca03895 commit e81d9a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/sour-bulldogs-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@clerk/clerk-js": patch
---

Improve the Smart CAPTCHA widget console error.
4 changes: 3 additions & 1 deletion packages/clerk-js/src/utils/captcha/hcaptcha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ export const getHCaptchaToken = async (captchaOptions: {
visibleDiv.style.display = 'block';
widgetDiv = visibleDiv;
} else {
console.error('Captcha DOM element not found. Using invisible captcha widget.');
console.error(
'Cannot initialize Smart CAPTCHA widget because the `clerk-captcha` DOM element was not found; falling back to Invisible CAPTCHA widget. If you are using a custom flow, visit https://clerk.com/docs/custom-flows/bot-sign-up-protection for instructions',
);
widgetDiv = createInvisibleDOMElement();
isInvisibleWidget = true;
hCaptchaSiteKey = invisibleSiteKey;
Expand Down
4 changes: 3 additions & 1 deletion packages/clerk-js/src/utils/captcha/turnstile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export const getTunstileToken = async (captchaOptions: {
visibleDiv.style.display = 'block';
widgetDiv = visibleDiv;
} else {
console.error('Captcha DOM element not found. Using invisible captcha widget.');
console.error(
'Cannot initialize Smart CAPTCHA widget because the `clerk-captcha` DOM element was not found; falling back to Invisible CAPTCHA widget. If you are using a custom flow, visit https://clerk.com/docs/custom-flows/bot-sign-up-protection for instructions',
);
widgetDiv = createInvisibleDOMElement();
isInvisibleWidget = true;
turnstileSiteKey = invisibleSiteKey;
Expand Down

0 comments on commit e81d9a5

Please sign in to comment.