openstreetmap / operations

OSMF Operations Working Group issue tracking
https://operations.osmfoundation.org/
98 stars 13 forks source link

Parsoid error when starting VisualEditor on wiki page with embedded video #1025

Open 1ec5 opened 5 months ago

1ec5 commented 5 months ago

If you attempt to open VisualEditor on any wiki page with an embedded video, VisualEditor fails to load, reporting an internal server error.

To reproduce, attempt to visually edit this revision of the “Key:wikidata” page. The following error appears:

[57b0850a37b2a552b0e408d2] Caught exception of type TypeError

This error comes from a JSON payload returned in a request for a parsed version of the page. The page contains this WebM video hosted on Wikimedia Commons (introduced here).

A similar error does not occur when visually editing a page that embeds a Commons video on another wiki, such as Wikipedia. This raises the possibility of a configuration issue in the OSM Wiki. Ultimately this could be an upstream issue, but someone with server access might need to pull a log for more details.

This issue was originally reported on Slack.

Firefishy commented 5 months ago

Is this not an upstream issue? We don't run customised mediawiki code.

1ec5 commented 5 months ago

Yes, it probably is an upstream issue in some sense, but I didn’t have quite enough information to report it in Wikimedia’s issue tracker, since the error is so generic. The theory was that maybe there would be a more specific error message on the server side.

jleedev commented 5 months ago

Able to reproduce using the docker image for MediaWiki 1.39.6 (after enabling VisualEditor, InstantCommons, TimedMediaHandler, asking it to spit out errors, and not having the name of the wiki be an ipv6 address…you know the drill).

This doesn't happen on the latest 1.42.0 running on Wikipedia, looks like it was fixed but it's worth seeing if it can be backported as 1.39 is labeled "LTS".

https://phabricator.wikimedia.org/T350594 https://gerrit.wikimedia.org/r/971537

[09550261e28cd81bd6cc594d] Exception caught: DOMElement::setAttribute(): Argument #2 ($value) must be of type string, null given

TypeError at /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/AddMediaInfo.php(193)
from /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/AddMediaInfo.php(193)
#0 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/AddMediaInfo.php(193): DOMElement->setAttribute(string, NULL)
#1 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/AddMediaInfo.php(336): Wikimedia\Parsoid\Wt2Html\PP\Processors\AddMediaInfo::addSources(Wikimedia\Parsoid\DOM\Element, array, stdClass, boolean)
#2 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/AddMediaInfo.php(802): Wikimedia\Parsoid\Wt2Html\PP\Processors\AddMediaInfo::handleVideo(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\DOM\Element, array, array, stdClass, Wikimedia\Parsoid\DOM\Element, NULL)
#3 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(157): Wikimedia\Parsoid\Wt2Html\PP\Processors\AddMediaInfo->run(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\DOM\Element, array, boolean)
#4 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(849): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->Wikimedia\Parsoid\Wt2Html\{closure}(Wikimedia\Parsoid\DOM\Element, array, boolean)
#5 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(890): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->doPostProcess(Wikimedia\Parsoid\DOM\Element)
#6 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(908): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->process(Wikimedia\Parsoid\DOM\Element)
#7 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#8 /var/www/html/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(308): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#9 /var/www/html/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(123): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#10 /var/www/html/vendor/wikimedia/parsoid/src/Parsoid.php(172): Wikimedia\Parsoid\Wikitext\ContentModelHandler->toDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI)
#11 /var/www/html/vendor/wikimedia/parsoid/src/Parsoid.php(210): Wikimedia\Parsoid\Parsoid->parseWikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOutput, array)
#12 /var/www/html/extensions/VisualEditor/includes/VisualEditorParsoidClient.php(123): Wikimedia\Parsoid\Parsoid->wikitext2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, NULL, ParserOutput)
#13 /var/www/html/extensions/VisualEditor/includes/ParsoidHelper.php(224): MediaWiki\Extension\VisualEditor\VisualEditorParsoidClient->getPageHtml(MediaWiki\Revision\RevisionStoreRecord, LanguageEn)
#14 /var/www/html/extensions/VisualEditor/includes/ApiParsoidTrait.php(134): MediaWiki\Extension\VisualEditor\ParsoidHelper->requestRestbasePageHtml(MediaWiki\Revision\RevisionStoreRecord, LanguageEn)
#15 /var/www/html/extensions/VisualEditor/includes/ApiVisualEditor.php(279): MediaWiki\Extension\VisualEditor\ApiVisualEditor->requestRestbasePageHtml(MediaWiki\Revision\RevisionStoreRecord)
#16 /var/www/html/includes/api/ApiMain.php(1900): MediaWiki\Extension\VisualEditor\ApiVisualEditor->execute()
#17 /var/www/html/includes/api/ApiMain.php(875): ApiMain->executeAction()
#18 /var/www/html/includes/api/ApiMain.php(846): ApiMain->executeActionWithErrorHandling()
#19 /var/www/html/api.php(90): ApiMain->execute()
#20 /var/www/html/api.php(45): wfApiMain()
#21 {main}