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

Unhandled Exception Google is not Defined #219

Closed
1 of 3 tasks
jconleyCB opened this issue Apr 19, 2023 · 8 comments · Fixed by #220 or #225
Closed
1 of 3 tasks

Unhandled Exception Google is not Defined #219

jconleyCB opened this issue Apr 19, 2023 · 8 comments · Fixed by #220 or #225
Labels
bug Something isn't working

Comments

@jconleyCB
Copy link

Describe the bug A clear and concise description of what the bug is.
The issue im seeing is when the google pay script doesnt load, an unhandled exception is thrown instead of passing the error to the config.onError.

To Reproduce Steps to reproduce the behavior:

  1. Go to this stackblitz
  2. Click on update all dependencies to latest
  3. inspect the page and block https://pay.google.com/gp/p/
  4. See error

Expected behavior A clear and concise description of what you expected to happen.
The updateElement function should have a check that google is defined before invoking this.client = new google.payments.api.PaymentsClient(this.createClientOptions(this.config));

Screenshots If applicable, add screenshots to help explain your problem.
Screenshot 2023-04-19 at 10 05 35 AM

Component information:

  • Component
    • React component (@google-pay/button-react)
    • Custom element (@google-pay/button-element)
    • Angular component (@google-pay/button-angular)
  • Component version (e.g. 1.0.0):

Environment:

  • Device (e.g. iPhone6):
  • OS (e.g. iOS8.1):
  • Browser (e.g. stock browser, safari)
  • Country/region:

Additional context Add any other context about the problem here.

@jconleyCB jconleyCB added the bug Something isn't working label Apr 19, 2023
@dmengelt
Copy link
Member

dmengelt commented Apr 19, 2023

@jconleyCB could you try with 3.0.6? We recently fixed a potentially related issue.
We still have to update our own stackblitz examples to use the latest version 😉

@jconleyCB
Copy link
Author

Yep its still an issue in 3.0.6. My assumption is that even though the try-catch catches the error for loading the script it continues down to this.updateElement() and that tries to reference google without it being defined

@dmengelt
Copy link
Member

@jconleyCB found the issue. will submit a fix.

@jconleyCB
Copy link
Author

Thank you @dmengelt!

@dmengelt
Copy link
Member

@jconleyCB please use version 3.0.8

@jconleyCB
Copy link
Author

@dmengelt So after using version 3.0.8 for a few days I noticed some users still came across the google being undefined error. Im not sure if the script loading guarantees that google is available, should a check for google be added to the updateElement(), before it's used?

@dmengelt
Copy link
Member

dmengelt commented May 1, 2023

Hi @jconleyCB very good point. Let me have a look at this.

@dmengelt
Copy link
Member

dmengelt commented May 2, 2023

@jconleyCB see #225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants