Page MenuHomePhabricator

Amazon Pay is broken with javascript error
Closed, ResolvedPublic

Description

After logging into Amazon and returning to paymentswiki, our form doesn't include the Amazon widget and throws the following javascript error:

VM159:16 Uncaught TypeError: Cannot read property 'Widgets' of undefined
    at createWalletWidget (eval at <anonymous> (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=sASRd7Vu:4), <anonymous>:16:146)
    at window.onAmazonLoginReady (eval at <anonymous> (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=vector&version=sASRd7Vu:4), <anonymous>:14:381)
    at Widgets.js:60
    at Widgets.js:62

Event Timeline

Pcoombe created this task.Mar 20 2018, 11:36 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 20 2018, 11:36 AM
DStrine triaged this task as High priority.Mar 20 2018, 5:54 PM
DStrine added a subscriber: DStrine.

This is not Unbreak Now but it is high priority during regular working hours. I'm adding to the spring for the team to look at.

I've removed Amazon from donatewiki and Ways to Give for now.

We were getting about 10-20 Amazon attempts per day. The last successful donation appears to be on 2018-03-15 if that helps in tracking the problem down.

Change 420808 had a related patch set uploaded (by Ejegg; owner: Ejegg):
[mediawiki/extensions/DonationInterface@master] Update Amazon JS for new widget ready event

https://gerrit.wikimedia.org/r/420808

Change 420808 merged by jenkins-bot:
[mediawiki/extensions/DonationInterface@master] Update Amazon JS for new widget ready event

https://gerrit.wikimedia.org/r/420808

Ejegg added a subscriber: Ejegg.EditedMar 20 2018, 7:49 PM

@Pcoombe thanks for noticing this! It's all set now - looks like they refactored the widget JS so that the loginReady event is called before the widget scripts are loaded.

There seems to be a new onAmazonPaymentsReady event that fires when the widget JS is ready, so I moved the wallet creation code into that function.

We can turn Amazon back on now.

Pcoombe closed this task as Resolved.Mar 20 2018, 8:00 PM
Pcoombe claimed this task.

Thanks for the quick fix @Ejegg. I've turned Amazon back on.

Ejegg added a comment.Mar 20 2018, 8:11 PM

Postmortem: We need to have some alerts (and good filters) on our error streams. Client-side errors like these are actually showing up in payments.error now.