Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recaptcha Cannot read properties of undefined errors #5

Closed
MikhailR1337 opened this issue Mar 28, 2024 · 3 comments
Closed

Recaptcha Cannot read properties of undefined errors #5

MikhailR1337 opened this issue Mar 28, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@MikhailR1337
Copy link

  • Browser - google chrome
  • "react": "^18.2.0",
  • react-recaptcha-that-works: "^2.0.1",
  • Did the problem happen after updating the library? - No
  • Are you using the library for the first time? - yes
  • It's a bug? - I have an error: TypeError: Cannot read properties of undefined (reading 'clients') (the first screenshot) after successfully solving Recaptcha I call nextjs router method.push -> router.push(url, undefined, { shallow: true }) and got it.

Investigated source code I found a solution -> unmount before using router.push -> but if I after that I try to come back to prev page I have another error TypeError: Cannot read properties of undefined (reading 'badge') (the second screenshot)

How can I overcome it?

image image
@douglasjunior
Copy link
Owner

This file in stack trace recaptcha_en.js is not from the react-recaptcha-that-works itself. Seems to be a file from inside reCAPTCHA SDK.

I never see these type of errors before, here we use the component in pages that are mounted and unmounted by react-router with no problems.

recaptcha

@douglasjunior douglasjunior added the help wanted Extra attention is needed label Mar 28, 2024
@MikhailR1337
Copy link
Author

@douglasjunior Thank you, it really looks like the problem has to do with GoogleReCaptchaProvider from 'react-google-recaptcha-v3'

@douglasjunior
Copy link
Owner

Oh, I have never used recaptcha v3 before, so I can't make sure that it will work with the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants