im trying to add recaptcha v3 in my magento pwa studios website but im getting this error
uncaught TypeError: globalThis.grecaptcha.render is not a function
this is happening in the contact page and on another page with a custom form. It only happens when the newsletter recaptcha is also enabled (it's on the footer and so it appears in every page)
This is the function where the error appears, in the useGoogleRecaptcha talon which i have not modified:
useEffect(() => {
// Only render if container is set and API is available
if (
inlineContainer !== null &&
isInline &&
apiIsReady &&
widgetId === null
) {
// Avoid loading twice if already rendered
if ('widgetId' in inlineContainer.dataset) {
setWidgetId(inlineContainer.dataset.widgetId);
} else {
const id = globalThis.grecaptcha.render(inlineContainer, {
sitekey: recaptchaKey,
size: 'invisible'
});
setWidgetId(id);
inlineContainer.dataset.widgetId = id;
}
}
}, [apiIsReady, isInline, recaptchaKey, widgetId, inlineContainer]);
in all 3 components (custom form, newsletter and contact-us form) i have added the recaptcha component the same way it's already implemented in venia with the login and register forms (i have adapted it to these other forms).
The recaptcha check itself seems to work except for that one error that pops up every now and then in those two pages.
Can anyone tell me what the problem is?