Google Pay button breaks with a stack trace when buttonType = (anything other than 'buy')
See original GitHub issueDescribe the bug
Sorry I’m not sure if this is the right repo to report this but it’s the closest I can find.
We use the Google Pay React button library in our project. Today we received reports our checkout was broken. Upon investigation we discovered that the “buttonType” property is causing an issue.
If a site specifies a buttonType that is anything other than “buy”, pay.js
will throw an exception and cause an error. In our situation the page became stuck and unresponsive. Once I removed this property and allowed the default, it worked again.
I can reproduce this on the Google demo site.
To Reproduce
- Go to ‘https://developers.google.com/pay/api/web/guides/resources/customize’
- Observe a Google Pay button is shown
- Click the “buttonType” and select some other value than “buy”
- Observe the button disappears and a stack trace is shown in the developer console
In this stack trace example I changed the buttonType to “donate” and it seems it is trying (and failing) to read a property of that string value.
pay.js:275 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'donate')
at m.pa (pay.js:275:150)
at m.pa (pay.js:286:382)
at l.<anonymous> (index.umd.min.js:15:4764)
at Generator.next (<anonymous>)
at index.umd.min.js:15:692
at new Promise (<anonymous>)
at e (index.umd.min.js:15:437)
at l.updateElement (index.umd.min.js:15:4150)
at l.configure (index.umd.min.js:15:2849)
at index.umd.min.js:15:8645
Expected behavior
It works as we would expect
Component information:
At least the pay.js
component.
Environment:
Reproduced on Chrome for Windows, Chrome for Android and Chrome for iOS.
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:9 (1 by maintainers)
Same here.
this was a temporary issue.