Social app first official Beta available

I dunno if you’ve seen it but there is first ever beta version of social out since some days… (only for NC 25 right now)

https://apps.nextcloud.com/apps/social

grab it, install it, test it, report bugs, help improving it!

yay!

and of course this might be something for you as well, dear @bug-hunters

1 Like

After installing and activating it, the “webfinger” warning appeared in /settings/admin/overview. A glance at the log revealed Social as the culprit. Please investigate why it grabs /index.php/.well-known/webfinger, and if that’s on purpose, make sure the Actor is available to handle it. Here’s the nextcloud.log entry (jq-formatted):

{
  "reqId": "B7mbg4cEvTPFnBY1e4LL",
  "level": 3,
  "time": "2023-02-03T18:22:00+01:00",
  "remoteAddr": "78.94.68.73",
  "user": "nursoda.admin",
  "app": "index",
  "method": "GET",
  "url": "/index.php/.well-known/webfinger",
  "message": "Actor not found",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0",
  "version": "25.0.3.2",
  "exception": {
    "Exception": "OCA\\Social\\Exceptions\\ActorDoesNotExistException",
    "Message": "Actor not found",
    "Code": 0,
    "Trace": [
      {
        "file": "/server/nc/apps/social/lib/Service/CacheActorService.php",
        "line": 193,
        "function": "getFromUsername",
        "class": "OCA\\Social\\Db\\ActorsRequest",
        "type": "->"
      },
      {
        "file": "/server/nc/apps/social/lib/WellKnown/WebfingerHandler.php",
        "line": 111,
        "function": "getFromLocalAccount",
        "class": "OCA\\Social\\Service\\CacheActorService",
        "type": "->"
      },
      {
        "file": "/server/nc/apps/social/lib/WellKnown/WebfingerHandler.php",
        "line": 83,
        "function": "handleWebfinger",
        "class": "OCA\\Social\\WellKnown\\WebfingerHandler",
        "type": "->"
      },
      {
        "file": "/server/nc/lib/private/Http/WellKnown/RequestManager.php",
        "line": 78,
        "function": "handle",
        "class": "OCA\\Social\\WellKnown\\WebfingerHandler",
        "type": "->"
      },
      {
        "function": "OC\\Http\\WellKnown\\{closure}",
        "class": "OC\\Http\\WellKnown\\RequestManager",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/server/nc/lib/private/Http/WellKnown/RequestManager.php",
        "line": 79,
        "function": "array_reduce"
      },
      {
        "file": "/server/nc/core/Controller/WellKnownController.php",
        "line": 55,
        "function": "process",
        "class": "OC\\Http\\WellKnown\\RequestManager",
        "type": "->"
      },
      {
        "file": "/server/nc/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 225,
        "function": "handle",
        "class": "OC\\Core\\Controller\\WellKnownController",
        "type": "->"
      },
      {
        "file": "/server/nc/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 133,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/server/nc/lib/private/AppFramework/App.php",
        "line": 172,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/server/nc/lib/private/Route/Router.php",
        "line": 298,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/server/nc/lib/base.php",
        "line": 1047,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/server/nc/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/server/nc/apps/social/lib/Db/ActorsRequest.php",
    "Line": 111,
    "CustomMessage": "--"
  }
}

Server is behind nginx proxy running on nginx using a (pimped) docs.nextcloud.com NGINX config. No issue when Social is disabled. Just created an issue for this.

1 Like

There are more log messages under /settings/admin/logging

/var/www/html/custom_apps/social/lib/Service/CacheActorService.php - line 193:
OCA\Social\Db\ActorsRequest->getFromUsername("")

/var/www/html/custom_apps/social/lib/WellKnown/WebfingerHandler.php - line 111:
OCA\Social\Service\CacheActorService->getFromLocalAccount("")

and so on…

The error message "Actor not found" comes out of social/lib/Db/ActorsRequest.php probably when getActorsSelectSql() doesn’t return valid data (or any data).

        /**
         * Return Actor from database based on the username
         *
         * @throws ActorDoesNotExistException
         * @throws SocialAppConfigException
         */
        public function getFromUsername(string $username): Person {
                $qb = $this->getActorsSelectSql();
                $this->limitToPreferredUsername($qb, $username);

                $cursor = $qb->executeQuery();
                $data = $cursor->fetch();
                $cursor->closeCursor();

                if ($data === false) {
                        throw new ActorDoesNotExistException('Actor not found');
                }

                return $this->parseActorsSelectSql($data);
        }

One thing I notice quickly is that there’s a column in oc_social_actor named "deleted" that is not represented in TABLE_ACTORS.

social/lib/Db/CoreRequestBuilder.php

public const TABLE_ACTORS = 'social_actor';

 self::TABLE_ACTORS => [
         'id_prim',
         'id',
         'user_id',
         'preferred_username',
         'name',
         'summary',
         'public_key',
         'private_key',
         'avatar_version',
         'creation'
 ],
MariaDB [nextcloud]> describe  oc_social_actor;
+--------------------+--------------+------+-----+---------+-------+
| Field              | Type         | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| id_prim            | varchar(32)  | NO   | PRI | NULL    |       |
| id                 | longtext     | YES  |     | NULL    |       |
| user_id            | varchar(63)  | YES  |     | NULL    |       |
| preferred_username | varchar(127) | YES  |     | NULL    |       |
| name               | varchar(127) | YES  |     |         |       |
| summary            | longtext     | YES  |     | NULL    |       |
| public_key         | longtext     | YES  |     | NULL    |       |
| private_key        | longtext     | YES  |     | NULL    |       |
| avatar_version     | int(11)      | YES  |     | NULL    |       |
| creation           | datetime     | YES  |     | NULL    |       |
| deleted            | datetime     | YES  |     | NULL    |       |
+--------------------+--------------+------+-----+---------+-------+
11 rows in set (0.002 sec)

in social/lib/Db/ActorsRequestBuilder.php

/**
 * Base of the Sql Select request for Shares
 *
 * @return SocialQueryBuilder
 */
protected function getActorsSelectSql(): SocialQueryBuilder {
        $qb = $this->getQueryBuilder();

        /** @noinspection PhpMethodParametersCountMismatchInspection */
        $qb->select(
                'a.id', 'a.id_prim', 'a.user_id', 'a.preferred_username', 'a.name', 'a.summary',
                'a.public_key', 'a.avatar_version', 'a.private_key', 'a.creation', 'a.deleted'
        )
           ->from(self::TABLE_ACTORS, 'a');

        $this->defaultSelectAlias = 'a';
        $qb->setDefaultSelectAlias('a');

        return $qb;
}

getActorsSelectSql() returns the column named deleted along with the other columns. I don’t know if the column named deleted column makes a difference.