news icon indicating copy to clipboard operation
news copied to clipboard

HTTP 500 error after adding https://geneva.cs.umd.edu/papers/, completely breaking this app

Open Mynacol opened this issue 1 year ago • 3 comments

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

  • [x] I have read the CONTRIBUTING.md and followed the provided tips
  • [x] I accept that the issue will be closed without comment if I do not check here
  • [x] I accept that the issue will be closed without comment if I do not fill out all items in the issue template.

Explain the Problem

I tried to add the website https://geneva.cs.umd.edu/papers/ as new feed (from an android client app). That seemed to work fine, but any reload of the News webpage or unread items list in the android client returns a HTTP 500 error. The feed I added is seemingly valid. The feed https://geneva.cs.umd.edu/index.xml is also affected (and also valid and contains items). Still, the error log shows that the feed title is null, leading to the HTTP error. The database has created the following entry in oc_news_feeds

 id  | folder_id | user_id |  last_modified   |             url_hash             |                                                                                                                                                                                                                                                                    url                                                                                                                                                                                                                                                                     |                                                                                                                                                                                                                                                                  location                                                                                                                                                                                                                                                                  |                                                    title                                                     |                                                                          link                                                                           |                                                                                                                     favicon_link                                                                                                                     |       http_last_modified        |   added    | articles_per_update | update_error_count |                                                                                                   last_update_error                                                                                                    | basic_auth_user | basic_auth_password | deleted_at | prevent_update | pinned | full_text_enabled | ordering | update_mode
 703 |        21 | user    | 1728466527257876 | fd1002fc21c325512ae14a795de48a1f | https://geneva.cs.umd.edu/papers/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | https://geneva.cs.umd.edu/papers/                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |                                                                                                              |                                                                                                                                                         |                                                                                                                                                                                                                                                      |                                 | 1728466524 |                   0 |                  1 | malformed xml string. parsing error : DOMDocument::loadXML(): Specification mandates value for attribute async in Entity, line: 64 (2)                                                                                 |                 |                     |          0 | f              | f      | f                 |        0 |           0

Setting the title column in the database to a string fixes this error.

Steps to Reproduce

Explain what you did to encounter the issue

  1. Add https://geneva.cs.umd.edu/papers/ as new feed (probably uses https://geneva.cs.umd.edu/papers/index.xml as it is referenced with a rel="alternate" type="application/rss+xml" tag)
  2. Try to open the main News webpage view (or refresh the list of unread elements in another client)
  3. A HTTP 500 error code is returned

System Information

  • News app version: 25.0.0-alpha9
  • Nextcloud version: 29.0.7
  • Cron type: system cron
  • PHP version: 8.3.12
  • Database and version: Postgresql 16.2
  • Browser and version: Firefox 131
  • OS and version: NixOS 24.05
Contents of nextcloud/data/nextcloud.log
{"reqId":"70SaVrXj9TLEvCULJ4k0","level":3,"time":"2024-10-09T09:57:04+00:00","remoteAddr":"[redacted]","user":"user","app":"index","method":"GET","url":"/apps/news/items?limit=40&oldestFirst=false&search=&showAll=false&type=6","message":"{\"Exception\":\"Exception\",\"Message\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75 in file '/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php' line 561\",\"Code\":0,\"Trace\":[{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/App.php\",\"line\":184,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/Route/Router.php\",\"line\":331,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/base.php\",\"line\":1058,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/index.php\",\"line\":49,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\"}],\"File\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/Http/Dispatcher.php\",\"Line\":170,\"Previous\":{\"Exception\":\"TypeError\",\"Message\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75\",\"Code\":0,\"Trace\":[{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php\",\"line\":75,\"function\":\"setTitle\",\"class\":\"OCA\\\\News\\\\Db\\\\Feed\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/QBMapper.php\",\"line\":321,\"function\":\"fromRow\",\"class\":\"OCP\\\\AppFramework\\\\Db\\\\Entity\",\"type\":\"::\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/QBMapper.php\",\"line\":339,\"function\":\"mapRowToEntity\",\"class\":\"OCP\\\\AppFramework\\\\Db\\\\QBMapper\",\"type\":\"->\"},{\"file\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/FeedMapperV2.php\",\"line\":69,\"function\":\"findEntities\",\"class\":\"OCP\\\\AppFramework\\\\Db\\\\QBMapper\",\"type\":\"->\"},{\"file\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Service/FeedServiceV2.php\",\"line\":101,\"function\":\"findAllFromUser\",\"class\":\"OCA\\\\News\\\\Db\\\\FeedMapperV2\",\"type\":\"->\"},{\"file\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Controller/ItemController.php\",\"line\":141,\"function\":\"findAllForUser\",\"class\":\"OCA\\\\News\\\\Service\\\\FeedServiceV2\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":232,\"function\":\"index\",\"class\":\"OCA\\\\News\\\\Controller\\\\ItemController\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":138,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/App.php\",\"line\":184,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/Route/Router.php\",\"line\":331,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/base.php\",\"line\":1058,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/index.php\",\"line\":49,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\"}],\"File\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php\",\"Line\":561},\"message\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75 in file '/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php' line 561\",\"exception\":{},\"CustomMessage\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75 in file '/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php' line 561\"}","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0","version":"29.0.7.1"}
{"reqId":"7xoMsPxNiKuVCSmH5zUb","level":3,"time":"2024-10-09T09:57:05+00:00","remoteAddr":"[redacted]","user":"user","app":"index","method":"GET","url":"/apps/news/feeds","message":"{\"Exception\":\"Exception\",\"Message\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75 in file '/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php' line 561\",\"Code\":0,\"Trace\":[{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/App.php\",\"line\":184,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/Route/Router.php\",\"line\":331,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/base.php\",\"line\":1058,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/index.php\",\"line\":49,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\"}],\"File\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/Http/Dispatcher.php\",\"Line\":170,\"Previous\":{\"Exception\":\"TypeError\",\"Message\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75\",\"Code\":0,\"Trace\":[{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php\",\"line\":75,\"function\":\"setTitle\",\"class\":\"OCA\\\\News\\\\Db\\\\Feed\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/QBMapper.php\",\"line\":321,\"function\":\"fromRow\",\"class\":\"OCP\\\\AppFramework\\\\Db\\\\Entity\",\"type\":\"::\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/QBMapper.php\",\"line\":339,\"function\":\"mapRowToEntity\",\"class\":\"OCP\\\\AppFramework\\\\Db\\\\QBMapper\",\"type\":\"->\"},{\"file\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/FeedMapperV2.php\",\"line\":69,\"function\":\"findEntities\",\"class\":\"OCP\\\\AppFramework\\\\Db\\\\QBMapper\",\"type\":\"->\"},{\"file\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Service/FeedServiceV2.php\",\"line\":101,\"function\":\"findAllFromUser\",\"class\":\"OCA\\\\News\\\\Db\\\\FeedMapperV2\",\"type\":\"->\"},{\"file\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Controller/FeedController.php\",\"line\":83,\"function\":\"findAllForUser\",\"class\":\"OCA\\\\News\\\\Service\\\\FeedServiceV2\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":232,\"function\":\"index\",\"class\":\"OCA\\\\News\\\\Controller\\\\FeedController\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":138,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/AppFramework/App.php\",\"line\":184,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/private/Route/Router.php\",\"line\":331,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/base.php\",\"line\":1058,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\"},{\"file\":\"/nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/index.php\",\"line\":49,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\"}],\"File\":\"/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php\",\"Line\":561},\"message\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75 in file '/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php' line 561\",\"exception\":{},\"CustomMessage\":\"OCA\\\\News\\\\Db\\\\Feed::setTitle(): Argument #1 ($title) must be of type string, null given, called in /nix/store/sccg58vzrqkb5j2c026h46hcis6jn3hg-nextcloud-29.0.7/lib/public/AppFramework/Db/Entity.php on line 75 in file '/nix/store/wmfrrzp8zrm0wx38ay5npjg9ax38wqba-source-patched/lib/Db/Feed.php' line 561\"}","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0","version":"29.0.7.1"}

The error points at https://github.com/nextcloud/news/blob/25.0.0-alpha9/lib/Db/Feed.php#L561, which extends the core Nextcloud Entity class, which enforces that title is a real string (not null).

The browser console is irrelevant here, but for completeness sake:

Contents of Browser Error Console Read http://ggnome.com/wiki/Using_The_Browser_Error_Console if you are unsure what to put here
Unified search initialized! UnifiedSearch.vue:54
XHRGET
https://cloud.mynacol.xyz/apps/news/items?limit=40&oldestFirst=false&search=&showAll=false&type=6
[HTTP/2 500  51ms]

session heartbeat polling started session-heartbeat.js:103:9
Registering notifications container as a menu NotificationsApp.vue:237
Browser does not support notifications NotificationsApp.vue:474
Polling interval updated to 30000 NotificationsApp.vue:443
Started background fetcher as session_keepalive is enabled NotificationsApp.vue:293
Got notification data, restoring default polling interval. NotificationsApp.vue:399
Contacts 
Array(26) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
UnifiedSearchModal.vue:279
XHRGET
https://cloud.mynacol.xyz/apps/news/feeds
[HTTP/2 500  58ms]

Search providers 
Array(15) [ {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, … ]
UnifiedSearchModal.vue:275
Uncaught (in promise) 
Object { stack: Getter & Setter, message: Getter & Setter, name: Getter & Setter, code: Getter & Setter, config: Getter & Setter, request: Getter & Setter, response: Getter & Setter, … }
vuex.esm.js:542:13
Uncaught (in promise) 
Object { stack: Getter & Setter, message: Getter & Setter, name: Getter & Setter, code: Getter & Setter, config: Getter & Setter, request: Getter & Setter, response: Getter & Setter, … }
main.js:33:16

Mynacol avatar Oct 09 '24 10:10 Mynacol

Seems related to https://github.com/nextcloud/news/pull/2745. But that would mean that we can't have feeds with empty titles.

SMillerDev avatar Oct 13 '24 13:10 SMillerDev

Yea the issue originally was that news would not accept feeds to have no title. That was changed in https://github.com/nextcloud/news/pull/869 But that caused DB errors when people added that feed since the DB schema did not allow Null. I created a migration that allowed Null in that field https://github.com/nextcloud/news/pull/2745

Now we have reached the point that reading the feed from the DB fails since the title is null.

As commented by others before it probably makes sense to use the parts of the url instead if there is no title. Since if there is no title there will be also nothing to display in the ui and clients might also not expect this field to be null.

I'm open for PRs but will not check the code myself.

Grotax avatar Oct 14 '24 07:10 Grotax

Counterpoint: that Feed does have a title tag for the Channel, so I'd expect the parsing to have failed somewhere for setting it correctly.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Papers on censorship.ai</title>
    <link>https://geneva.cs.umd.edu/papers/</link>
    <description>Recent content in Papers on censorship.ai</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-US</language><atom:link href="https://geneva.cs.umd.edu/papers/index.xml" rel="self" type="application/rss+xml" />
  </channel>
</rss>

pludi avatar Oct 16 '24 13:10 pludi