nextcloud / social

🎉 Social can be used for work, or to connect to the fediverse!
https://apps.nextcloud.com/apps/social
GNU Affero General Public License v3.0
491 stars 59 forks source link

Webfinger: `Exception parse_str(): Argument #1 ($string) must be of type string, null given in file '/opt/nextcloud/apps/social/lib/WellKnown/WebfingerHandler.php' line [...]` #1888

Open HighWingy opened 6 months ago

HighWingy commented 6 months ago

Describe the bug Going to the url for webfinger on my Nextcloud gives an internal server error. And when I check the logs, I see the following message:

Exception parse_str(): Argument #1 ($string) must be of type string, null given in file '/opt/nextcloud/apps/social/lib/WellKnown/WebfingerHandler.php' line 235

To Reproduce Steps to reproduce the behavior:

  1. Go to https://cloud.home.dragongames.net/index.php/.well-known/webfinger
  2. See error

Expected behavior I'm not entirely sure what is supposed to happen as I've never been able to get this to work. But I do know that the 500 error and the error in the log file are not correct

Screenshots n/a my site is public ish

Client details:

Server details **Social app version:** 8.0 **Operating system**: Debian 12.5 **Web server:** Apache2 **Database:** MariaDB **PHP version:** 8.2 **Nextcloud version:** (see Nextcloud admin page) 29
Logs #### Nextcloud log (data/nextcloud.log) ``` Exception parse_str(): Argument #1 ($string) must be of type string, null given in file '/opt/nextcloud/apps/social/lib/WellKnown/WebfingerHandler.php' line 235 #### Browser log ``` n/a this is all server side
noci2012 commented 2 months ago
{
  "reqId": "IhilB622InmPCwv23SD0",
  "level": 4,
  "time": "2024-09-24T13:07:15+00:00",
  "remoteAddr": "192.168.7.117",
  "user": "--",
  "app": "social",
  "method": "GET",
  "url": "/apps/logreader/api/poll?lastReqId=RkpiDP9XvTgAf96Sv9l7",
  "message": "Error during app service registration: Call to undefined method OC\\Server::getEventDispatcher()",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
  "version": "30.0.0.14",
  "exception": {
    "Exception": "Error",
    "Message": "Call to undefined method OC\\Server::getEventDispatcher()",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/social/lib/AppInfo/Application.php",
        "line": 71,
        "function": "registerDeprecatedListener",
        "class": "OCA\\Social\\AppInfo\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php",
        "line": 99,
        "function": "register",
        "class": "OCA\\Social\\AppInfo\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php",
        "line": 48,
        "function": "registerApps",
        "class": "OC\\AppFramework\\Bootstrap\\Coordinator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 657,
        "function": "runInitialRegistration",
        "class": "OC\\AppFramework\\Bootstrap\\Coordinator",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1132,
        "function": "init",
        "class": "OC",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 22,
        "args": [
          "/var/www/nextcloud/lib/base.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/apps/social/lib/AppInfo/Application.php",
    "Line": 82,
    "message": "Error during app service registration: Call to undefined method OC\\Server::getEventDispatcher()",
    "exception": [],
    "CustomMessage": "Error during app service registration: Call to undefined method OC\\Server::getEventDispatcher()"
  },
  "id": "66f2b98370f2a"
}
paulvt commented 1 month ago

I didn't have this before, but I have it now that I updated to the release 0.7.0. Were you running a snapshot after 0.6.2 @HighWingy?

noci2012 commented 3 weeks ago

DbalException An exception occurred while executing a query: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_social_actor' doesn't exist

Both after upgrade and removal and reinstall, just opening the app).

joshtrichards commented 1 week ago

While social should handle missing parameters better to avoid the exception (that's the bug), technically it doesn't impact functionality because it only occurs if you leave off the required ?resource= parameter when querying the /.well-known/webfinger URL.

joshtrichards commented 1 week ago

If you're able, test #1951. Should fix this issue.

oculos commented 1 week ago

If you're able, test #1951. Should fix this issue.

It didn't for me. The error now is on line 229, which is, for me, this:

    parse_str(parse_url($requestUri, PHP_URL_QUERY), $query);
HighWingy commented 1 week ago

I feel I should add I don't only get this error when going to the well-known url. It happens when trying to view user profiles via the social app, and various other actions on it. I can post and view messages, so it's not like it's completely broken. But that makes me think that there is something else going on for profile pages to also be generating this same error?

slorquet commented 1 week ago

this bug is still present in the last release installed via the app manager, and prevent nextcloud accounts from being followed from mastodon at least. this is a showstopper as it renders nextcloud social completely useless for most use cases (eg fediverse self hosting)

edit: it's not the webfinger. the webfinger works. but the URL retrieved next by mastodon just returns a broken webpage

Here are my logs (actual account name changed):

192.168.0.6 - - [22/Nov/2024:03:49:14 -0600] "GET /.well-known/webfinger?resource=acct:user@example.com HTTP/1.1" 200 1766 "-" "Mastodon/4.3.1 (http.rb/5.2.0; +https://chaos.social/)"
192.168.0.6 - - [22/Nov/2024:03:49:14 -0600] "GET /index.php/apps/social/@user HTTP/1.1" 200 2208 "-" "Mastodon/4.3.1 (http.rb/5.2.0; +https://chaos.social/)"

Last URL returns a page with an infinite spinner. and nothing else happens.

When I visit the above page while not being loaded, the page displays a popup that says: Failed to load relationship info

looks like there is a neglected entry for this bug: https://github.com/nextcloud/social/issues/1160