Page MenuHomePhabricator

/ifttt/v1/triggers/picture_of_the_day consistent 'list index out of range' error
Closed, ResolvedPublicBUG REPORT

Description

Relatively recently the picture of the day trigger began failing with a 'list index out of range' exception from the code that parses the RSS feed xml using css selectors. This seems likely to be a change in the css classes applied.

2023-07-23T23:14:05Z ifttt.core   ERROR   : Exception on /ifttt/v1/triggers/picture_of_the_day [POST]
Traceback (most recent call last):
  File "/data/project/ifttt-dev/www/python/venv/lib/python3.9/site-packages/flask/app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "/data/project/ifttt-dev/www/python/venv/lib/python3.9/site-packages/flask/app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/data/project/ifttt-dev/www/python/venv/lib/python3.9/site-packages/flask/app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "/data/project/ifttt-dev/www/python/venv/lib/python3.9/site-packages/flask/app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/data/project/ifttt-dev/www/python/venv/lib/python3.9/site-packages/flask/views.py", line 107, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "/data/project/ifttt-dev/www/python/venv/lib/python3.9/site-packages/flask/views.py", line 188, in dispatch_request
    return current_app.ensure_sync(meth)(**kwargs)
  File "./ifttt/triggers.py", line 176, in post
    data = self.get_data()[: self.limit]
  File "./ifttt/triggers.py", line 235, in get_data
    return list(map(self.parse_entry, feed.entries))
  File "./ifttt/triggers.py", line 274, in parse_entry
    image_node = select(summary, "a.image img")
  File "./ifttt/utils.py", line 40, in select
    return matches[0]
IndexError: list index out of range

Details

TitleReferenceAuthorSource BranchDest Branch
Get upstream tests working againtoolforge-repos/ifttt!19bd808work/bd808/T342014main
Customize query in GitLab

Event Timeline

The failing selector is looking for "a.image img". The document fragment being parsed instead has "a.mw-file-description img" content. After a big of digging I found that this change was caused by T314318: Disable wgParserEnableLegacyMediaDOM on all wikis which was applied to commonswiki in rOMWC764004824288: Disable wgParserEnableLegacyMediaDOM on group2 wikis. The commit title slightly deceptively as both commonswiki and metawiki were held back from their group1 peers for this final change.

bd808 changed the task status from Open to In Progress.Jul 24 2023, 12:34 AM
bd808 claimed this task.
bd808 triaged this task as Medium priority.

The test suite is passing again. I have emailed the ifft support folks to re-enable our service. They had paused it again because of the persistent error state of the picture_of_the_day endpoint. I will leave this task open until I hear from them that the service has been re-enabled.