recaptcha icon indicating copy to clipboard operation
recaptcha copied to clipboard

Can't find variable: grecaptcha

Open erinzobitz opened this issue 5 years ago • 3 comments

I'm utilizing the reCAPTCHA v3 API and am seeing the error Can't find variable: grecaptcha come through logs on a recurring basis.

It is recurring with a specific newsletter action because it errors out when attempting to call executeRecaptchaForNewsletter.

Here's is my implementation –

    if verify_recaptcha(action: 'newsletter', minimum_score: 0.5)
      SignEmailUpForMailingListJob.perform_later(params[:email])
    end

However, the urls where the error is occurring do not even include the= recaptcha_v3 code as they are all internal urls.

I'm assuming this error is timing related but would appreciate any insight you might have.

erinzobitz avatar Sep 30 '19 19:09 erinzobitz

only place grecaptcha is used is in js https://github.com/ambethia/recaptcha/search?q=grecaptcha&unscoped_q=grecaptcha ... are you sure these errors are coming from ruby ? ... try disabling rails backtrace filter to see where exactly they come from

grosser avatar Oct 01 '19 15:10 grosser

@grosser I see these errors too from js, mostly on windows with edge or chrome. Problem seems to be coming from

https://github.com/ambethia/recaptcha/blob/8fd0ee1c6cd34810f55278b2aa2ddee0fd43483c/lib/recaptcha/helpers.rb#L195

which is invoked immediately. The errors could be coming possibly because of race conditions between api.js load and execution of this line? Can we move this to the onload callback?

aandis avatar Feb 05 '21 03:02 aandis

try making a PR with a change and see if it works, can try the demo too I don't use it atm / don't have it running to debug

On Thu, Feb 4, 2021 at 7:49 PM Abhishek [email protected] wrote:

@grosser https://github.com/grosser I see these errors too from js, mostly on windows with edge or chrome. Problem seems to be coming from

https://github.com/ambethia/recaptcha/blob/8fd0ee1c6cd34810f55278b2aa2ddee0fd43483c/lib/recaptcha/helpers.rb#L195

which is invoked immediately. The errors could be coming possibly because of race conditions between api.js load and execution of this line? Can we move this to the onload callback?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ambethia/recaptcha/issues/333#issuecomment-773768056, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACYZ5QIF4G2R36WSPCZV3S5NTC7ANCNFSM4I374IJA .

grosser avatar Feb 05 '21 21:02 grosser