Recently, we added the "targetUrl" variable to the "PublishedTranslationDTO" class, which corresponds to the "translation_target_url" field inside "cx_translations" table. The "targetUrl" argument in the PublishedTranslationDTO constructor is required to be a (non-nullable) string.
Regarding this decision, we always set the "translation_target_url" field inside the corresponding row of the "cx_translations" table, when publishing an article (ApiContentTranslationPublish class) or a section (ApiSectionTranslationPublish class). Thus, the argument passed to the "PublishedTranslationDTO" constructor is indeed expected to be a string (since "translation_target_url" is always non-null for translations that have been published).
However, there are some, yet unidentified, cases where the "targetUrl" parameter is null, leading to PHP error and broken published translation fetching requests. Such an error, as it appears in Logstash, is provided below:
{ "_index": "logstash-deploy-1-7.0.0-1-2023.09.29", "_id": "5eJx4IoBi6TOjMqmMmxG", "_score": 1, "_source": { "tags": [ "input-kafka-rsyslog-udp-localhost", "rsyslog-udp-localhost", "kafka", "es", "es" ], "message_checksum": "3d163c71236ee64c61cf1558e7b1191a", "http_method": "GET", "severity": "err", "server": "el.wikipedia.org", "host": "mw1359", "wiki": "elwiki", "caught_by": "entrypoint", "channel": "exception", "url": "/w/api.php?action=query&assert=user&format=json&formatversion=2&list=contenttranslation§iontranslationsonly=true&type=published", "timestamp": "2023-09-29T10:17:08+00:00", "logsource": "mw1359", "message": "[8cb75f1d-8c37-44c2-a814-a0438059d47b] /w/api.php?action=query&assert=user&format=json&formatversion=2&list=contenttranslation§iontranslationsonly=true&type=published TypeError: Argument 9 passed to ContentTranslation\\DTO\\PublishedTranslationDTO::__construct() must be of the type string, null given, called in /srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/Store/SectionTranslationStore.php on line 299", "exception_url": "/w/api.php?action=query&assert=user&format=json&formatversion=2&list=contenttranslation§iontranslationsonly=true&type=published", "monolog_level": 400, "facility": "user", "referrer": null, "normalized_message": "[{reqId}] {exception_url} TypeError: Argument 9 passed to ContentTranslation\\DTO\\PublishedTranslationDTO::__construct() must be of the type string, null given, called in /srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/Store/Secti", "@version": 1, "type": "mediawiki", "mwversion": "1.41.0-wmf.28", "phpversion": "7.4.33", "level": "ERROR", "exception": { "trace": "from /srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/DTO/PublishedTranslationDTO.php(19)\n#0 /srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/Store/SectionTranslationStore.php(299): ContentTranslation\\DTO\\PublishedTranslationDTO->__construct(integer, string, string, string, string, string, string, string, NULL, array)\n#1 /srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/ActionApi/ApiQueryContentTranslation.php(156): ContentTranslation\\Store\\SectionTranslationStore->findPublishedSectionTranslationsByUser(integer, NULL, NULL, integer, NULL)\n#2 /srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/ActionApi/ApiQueryContentTranslation.php(62): ContentTranslation\\ActionApi\\ApiQueryContentTranslation->run()\n#3 /srv/mediawiki/php-1.41.0-wmf.28/includes/api/ApiQuery.php(695): ContentTranslation\\ActionApi\\ApiQueryContentTranslation->execute()\n#4 /srv/mediawiki/php-1.41.0-wmf.28/includes/api/ApiMain.php(1931): ApiQuery->execute()\n#5 /srv/mediawiki/php-1.41.0-wmf.28/includes/api/ApiMain.php(908): ApiMain->executeAction()\n#6 /srv/mediawiki/php-1.41.0-wmf.28/includes/api/ApiMain.php(879): ApiMain->executeActionWithErrorHandling()\n#7 /srv/mediawiki/php-1.41.0-wmf.28/api.php(95): ApiMain->execute()\n#8 /srv/mediawiki/php-1.41.0-wmf.28/api.php(48): wfApiMain()\n#9 /srv/mediawiki/w/api.php(3): require(string)\n#10 {main}", "message": "Argument 9 passed to ContentTranslation\\DTO\\PublishedTranslationDTO::__construct() must be of the type string, null given, called in /srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/Store/SectionTranslationStore.php on line 299", "code": 0, "class": "TypeError", "file": "/srv/mediawiki/php-1.41.0-wmf.28/extensions/ContentTranslation/includes/DTO/PublishedTranslationDTO.php:19" }, "program": "mediawiki", "@timestamp": "2023-09-29T10:17:08.641Z", "servergroup": "api_appserver", "shard": "s3", "reqId": "8cb75f1d-8c37-44c2-a814-a0438059d47b" }, "fields": { "@timestamp": [ "2023-09-29T10:17:08.641Z" ] } }
For now, the proposed approach is to let the "targetUrl" parameter be nullable, to avoid blocking the fetching requests, until the root cause is found.