Page MenuHomePhabricator

Uncaught TypeError: Cannot read property 'resolve' of undefined / queue[title] is undefined
Closed, ResolvedPublic

Description

Last 10 days:

46	Uncaught TypeError: Cannot read property 'resolve' of undefined

Event Timeline

Change 297120 had a related patch set uploaded (by Bartosz Dziewoński):
Set 'group' => 'ext.uploadWizard' for all our modules

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

Change 297120 merged by jenkins-bot:
Set 'group' => 'ext.uploadWizard' for all our modules

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

No, I'm still debugging it. The patch above is supposed to help.

Like with T136237, none of the remaining errors seem to be coming from UploadWizard.

matmarex renamed this task from Uncaught TypeError: Cannot read property 'resolve' of undefined to Uncaught TypeError: Cannot read property 'resolve' of undefined / queue[title] is undefined.Aug 23 2016, 1:37 PM
matmarex reopened this task as Open.

I was wrong. There is a small number of errors like this from mw.widgets.CategoryCapsuleItemWidget, also as TypeError: queue[title] is undefined.

I think it happens when the result of title normalization is different in PHP and JS code, and thus we can't find an entry for the title in the API response. But I can't think of any input that would cause this. I'll add some debug logging.

Change 306208 had a related patch set uploaded (by Bartosz Dziewoński):
mw.widgets.CategoryCapsuleItemWidget: Debug logging for "queue[title] is undefined"

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

Change 306208 merged by jenkins-bot:
mw.widgets.CategoryCapsuleItemWidget: Debug logging for "queue[title] is undefined"

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

Change 306234 had a related patch set uploaded (by Bartosz Dziewoński):
mw.widgets.CategoryCapsuleItemWidget: Debug logging for "queue[title] is undefined"

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

Change 306235 had a related patch set uploaded (by Bartosz Dziewoński):
mw.widgets.CategoryCapsuleItemWidget: Debug logging for "queue[title] is undefined"

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

Change 306235 merged by jenkins-bot:
mw.widgets.CategoryCapsuleItemWidget: Debug logging for "queue[title] is undefined"

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

Change 306234 merged by jenkins-bot:
mw.widgets.CategoryCapsuleItemWidget: Debug logging for "queue[title] is undefined"

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

Mentioned in SAL [2016-08-23T18:24:41Z] <thcipriani@tin> Synchronized php-1.28.0-wmf.16/resources/src/mediawiki.widgets/mw.widgets.CategoryCapsuleItemWidget.js: SWAT: [[gerrit:306235|Debug logging for "queue[title] undefined" (T139130)]] (duration: 00m 50s)

Mentioned in SAL [2016-08-23T18:26:05Z] <thcipriani@tin> Synchronized php-1.28.0-wmf.15/resources/src/mediawiki.widgets/mw.widgets.CategoryCapsuleItemWidget.js: SWAT: [[gerrit:306234|Debug logging for "queue[title] undefined" (T139130)]] (duration: 00m 50s)

Got one already:

Error: No queue for "Category:Manor house in Grodkowice", requested "Category:Manor house in Grodkowice‎"

There is an invisible character "‎"‎ U+200E LEFT-TO-RIGHT MARK at the end of the requested category. Something should be stripping it out at some point somewhere.

Another:

Uncaught Error: No queue for "Category:ਖ਼ਬਰ ਪੰਜਾਬ ਦੀ", requested "Category:ਖ਼ਬਰ ਪੰਜਾਬ ਦੀ"

The two values have different Unicode composition (input is not in NFC form). The actual bytes are:

API response[67, 97, 116, 101, 103, 111, 114, 121, 58, 224, 168, 150, 224, 168, 188, 224, 168, 172, 224, 168, 176, 32, 224, 168, 170, 224, 169, 176, 224, 168, 156, 224, 168, 190, 224, 168, 172, 32, 224, 168, 166, 224, 169, 128]
Input[67, 97, 116, 101, 103, 111, 114, 121, 58, 224, 169, 153, 224, 168, 172, 224, 168, 176, 32, 224, 168, 170, 224, 169, 176, 224, 168, 156, 224, 168, 190, 224, 168, 172, 32, 224, 168, 166, 224, 169, 128]

For the first case, we can just use the 'normalized' section of the API result to map what we have to what we need. https://commons.wikimedia.beta.wmflabs.org/w/api.php?action=query&format=jsonfm&formatversion=2&prop=info&titles=Category%3AManor+house+in+Grodkowice%E2%80%8E

For the second case… it's pretty hopeless. NFC normalization happens very early in MediaWiki and the API doesn't even know the input was in a non-NFC form, and doesn't provide anything to help. https://commons.wikimedia.beta.wmflabs.org/w/api.php?action=query&format=jsonfm&formatversion=2&prop=info&titles=%E0%A9%99%E0%A8%AC%E0%A8%B0%20%E0%A8%AA%E0%A9%B0%E0%A8%9C%E0%A8%BE%E0%A8%AC%20%E0%A8%A6%E0%A9%80 There is String.prototype.normalize(), but not widely supported. Unless we want to implement NFC normalization client-side (we don't), I guess the only option is to query for only one title at a time?

For the first case, we can just use the 'normalized' section of the API result to map what we have to what we need. https://commons.wikimedia.beta.wmflabs.org/w/api.php?action=query&format=jsonfm&formatversion=2&prop=info&titles=Category%3AManor+house+in+Grodkowice%E2%80%8E

For the second case… it's pretty hopeless. NFC normalization happens very early in MediaWiki and the API doesn't even know the input was in a non-NFC form, and doesn't provide anything to help. https://commons.wikimedia.beta.wmflabs.org/w/api.php?action=query&format=jsonfm&formatversion=2&prop=info&titles=%E0%A9%99%E0%A8%AC%E0%A8%B0%20%E0%A8%AA%E0%A9%B0%E0%A8%9C%E0%A8%BE%E0%A8%AC%20%E0%A8%A6%E0%A9%80 There is String.prototype.normalize(), but not widely supported.

It's wide enough for us to attempt it if available, though? Cr34+/FF31+/Edge ~= 53% of all our traffic last week…

Unless we want to implement NFC normalization client-side (we don't), I guess the only option is to query for only one title at a time?

https://github.com/walling/unorm doesn't look too bad, but maybe…

Unless we want to implement NFC normalization client-side (we don't), I guess the only option is to query for only one title at a time?

https://github.com/walling/unorm doesn't look too bad, but maybe…

Even with an existing library, this is 100K+ of data we'd have to send to the client.

Change 306547 had a related patch set uploaded (by Bartosz Dziewoński):
mw.widgets.CategoryCapsuleItemWidget: Handle titles not normalized in JS code

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

Change 306547 merged by jenkins-bot:
mw.widgets.CategoryCapsuleItemWidget: Handle titles not normalized in JS code

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

matmarex removed a project: Patch-For-Review.

That patch was the only one required to fix this (depending on T29849). The other "blockers" are only good-to-haves.