Page MenuHomePhabricator

Fundraising banner throwing high amount of errors relating to bad jQuery selector
Closed, ResolvedPublic

Description

Around 5,603 errors are coming from an unknown source on French Wikipedia across a 12 hour period. The error is not normalized but is of the form
"(Uncaught Error: Syntax error, unrecognized expression: [id=*)"

for example: "Uncaught Error: Syntax error, unrecognized expression: [id='Tentative_d'assassinat'] "

What's likely is a gadget/user script/extension/banner is trying to construct a jQuery selector programmatically but is not escaping the single quote character. The stack trace provides few clues due to a lack of named functions or the source of the gadget.

The offending code likely looks something like this: $("[id='"+anchor+"']");

Being able to determine whether this is impacting anonymous users, whether it originates from a banner would be needed to diagnose further.

https://logstash.wikimedia.org/goto/400c81dfa8b301126b24f225402305cc

Event Timeline

Jdlrobson renamed this task from Unknown script throwing high amount of errors relating to bad jQuery selector to Fundraising banner throwing high amount of errors relating to bad jQuery selector.Oct 8 2020, 6:08 PM
Jdlrobson added a subscriber: jbolorinos-ctr.

Thanks to a mention of frb.initNag in this stack trace I was able to track this down last night to this banner:
https://fr.wikipedia.org/wiki/Uniforme_scolaire?banner=B2021_1008_enFR_dsk_p1_lg_txt_nec#Allemagne

https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2020.10.08/clienterror/?id=AXUJHrGK1pGl6xFME3AZ

I can replicate it when clicking table of contents items with single quotes on https://meta.wikimedia.org/wiki/Special:CentralNoticeBanners/edit/B2021_1008_enFR_dsk_p1_lg_txt_nec but I don't have edit rights to fix this.

The number of errors this is logging blocks us from rolling out error logging to English Wikipedia, and possibly impacts how the nags work in any A/B tests working so this should be considered high priority to fix if not UBN.

I'm working on a fix for this, using the ':target' selector instead, which simplifies the code. Should finish testing and rolling it out tomorrow.

Jdlrobson claimed this task.

We got a quick fix out of this - thanks @Pcoombe

Screen Shot 2020-10-09 at 8.13.18 AM.png (390×1 px, 42 KB)

I am going to propose we tag errors with active banners based on the value of mw.centralNotice.isBannerShown(), so these are easier to track down in future.