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
488 stars 59 forks source link

Trying to follow creativecoding@libranet.de results in OCA\Social\Exceptions\ItemUnknownException #1133

Closed zeitgeist87 closed 3 years ago

zeitgeist87 commented 3 years ago

Trying to follow creativecoding@libranet.de results in an OCA\Social\Exceptions\ItemUnknownException. I added the following line just before the exception occurs to /srv/http/cloud.mydomain.com/apps/social/lib/AP.php

var_dump($this->get('type', $data, ''));

It prints out string(5) "Group". Apparantly Group is an unknown type.

./occ social:account:follow -vvv zeitgeist creativecoding@libranet.de
string(5) "Group"

In AP.php line 383:

  [OCA\Social\Exceptions\ItemUnknownException]  

Exception trace:
  at /srv/http/cloud.mydomain.com/apps/social/lib/AP.php:383
 OCA\Social\AP->getItemFromType() at /srv/http/cloud.mydomain.com/apps/social/lib/AP.php:284
 OCA\Social\AP->getSimpleItemFromData() at /srv/http/cloud.mydomain.com/apps/social/lib/AP.php:216
 OCA\Social\AP->getItemFromData() at /srv/http/cloud.mydomain.com/apps/social/lib/Service/CurlService.php:207
 OCA\Social\Service\CurlService->retrieveAccount() at /srv/http/cloud.mydomain.com/apps/social/lib/Service/CacheActorService.php:218
 OCA\Social\Service\CacheActorService->getFromAccount() at /srv/http/cloud.mydomain.com/apps/social/lib/Service/FollowService.php:137
 OCA\Social\Service\FollowService->followAccount() at /srv/http/cloud.mydomain.com/apps/social/lib/Command/AccountFollowing.php:122
 OCA\Social\Command\AccountFollowing->execute() at /srv/http/cloud.mydomain.com/3rdparty/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at /srv/http/cloud.mydomain.com/core/Command/Base.php:169
 OC\Core\Command\Base->run() at /srv/http/cloud.mydomain.com/3rdparty/symfony/console/Application.php:1012
 Symfony\Component\Console\Application->doRunCommand() at /srv/http/cloud.mydomain.com/3rdparty/symfony/console/Application.php:272
 Symfony\Component\Console\Application->doRun() at /srv/http/cloud.mydomain.com/3rdparty/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /srv/http/cloud.mydomain.com/lib/private/Console/Application.php:215
 OC\Console\Application->run() at /srv/http/cloud.mydomain.com/console.php:100
 require_once() at /srv/http/cloud.mydomain.com/occ:11

social:account:following [--output [OUTPUT]] [--local] [--unfollow] [--] <userId> <account>

This command worked ./occ social:account:follow -vvv zeitgeist nasa@social.yl.ms, but it did have the type "Service" instead of "Group"

To Reproduce Steps to reproduce the behavior:

  1. Execute ./occ social:account:follow -vvv zeitgeist creativecoding@libranet.de

Expected behavior I expected that it would follow the account.

Client details:

Server details ## Server configuration detail **Operating system:** Linux 5.9.9-arch1-1 #1 SMP PREEMPT Wed, 18 Nov 2020 19:52:04 +0000 x86_64 **Webserver:** Apache/2.4.46 (Unix) OpenSSL/1.1.1h (fpm-fcgi) **Database:** pgsql PostgreSQL 12.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 10.2.0, 64-bit **PHP version:** 7.4.12 Modules loaded: Core, date, libxml, openssl, pcre, zlib, ctype, dom, fileinfo, filter, hash, json, mbstring, pcntl, SPL, PDO, bz2, posix, readline, Reflection, session, SimpleXML, standard, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, cgi-fcgi, curl, zip, apcu, Phar, exif, gd, gettext, pdo_pgsql, pgsql, sqlite3, intl, iconv, imagick, Zend OPcache **Nextcloud version:** 19.0.5 - 19.0.5.2
zeitgeist87 commented 3 years ago

I also get the same error with this command: ./occ social:account:follow -vvv zeitgeist piratenpartei@pirati.ca

However, this time it prints out string(12) "Organization". So "Organization" seems to be an unknown type as well. Most things I would like to follow have an unknown type apparently :)

zeitgeist87 commented 3 years ago

Also peertube-Accounts don't work. Same Error: ./occ social:account:follow -vvv zeitgeist techlore_channel@tube.privacytools.io This time the unknown type is again string(5) "Group"

zeitgeist87 commented 3 years ago

I have upgraded to Nextcloud 20 and Social 0.4.1 and I still have the same issue.

zeitgeist87 commented 3 years ago

I installed the version from the current master branch. Still no luck. Same issue../occ social:reset also does not help.

What can I do to help?

mnd commented 3 years ago

@zeitgeist87 I prepared PR https://github.com/nextcloud/social/pull/1138 with changes that allow you to follow mentioned accounts. You can try it by yourself if you want to get this feature prior to review by nextcloud social maintainers.

zeitgeist87 commented 3 years ago

@mnd Thank you for the PR. I tried it and there is no longer this particular error message and I can follow the accounts.

However, the accounts do not appear in the list of accounts that I am following on my profile page. Only Mastodon Accounts appear there.

In the Nextcloud Logs there is a strange exception:

ext | 500 - {"status":-1,"exception":"OCA\\Social\\Exceptions\\InvalidOriginException","message":"ACore::checkOrigin - id: https:\/\/cloud.mydomain.com\/apps\/social\/@zeitgeist\/accepts\/follows\/14125 - origin: peertube.fr"}
-- | --

Something seems to be wrong still. How can I help to debug this?

mnd commented 3 years ago

However, the accounts do not appear in the list of accounts that I am following on my profile page

This happened because your server did not got/process follow accept message. You can find in database in oc_social_3_follow table that you request was not accepted. Such not-accepted request not displayed in follow list (should be separate Feature Request for Nextcloud Social).

I checked mentioned accounts from your message:

  1. creativecoding@libranet.de -- works for me
  2. piratenpartei@pirati.ca -- I can't see Accept message from this server. Is there any chance that subscription to this user should be manually approved by target account?
  3. For peertube you correctly spot the issue. According to the https://www.w3.org/TR/2018/REC-activitypub-20180123/#obj-id :

Publicly dereferencable URIs, such as HTTPS URIs, with their authority belonging to that of their originating server. (Publicly facing content SHOULD use HTTPS URIs).

So in Accept message the source server name should be same as a hostname in the message ID field. But in Accept message for subscription to the techlore_channel@tube.privacytools.io I see the following message:

{
    "actor": "https://tube.privacytools.io/video-channels/techlore_channel",
    "id": "https://cloud.mndet.net/apps/social/@mnd/accepts/follows/393",
    "type": "Accept"
    "object": {
        "actor": "https://cloud.mndet.net/apps/social/@mnd",
        "id": "https://cloud.mndet.net/apps/social/@mnd/follows/393",
        "object": "https://tube.privacytools.io/video-channels/techlore_channel",
        "type": "Follow"
    },
}

i.e. message id was generated with my domain authority instead of tube.privacytools.io required by standard.

If you want to loose this authority check you can comment out the following line: https://github.com/nextcloud/social/blob/2bbc2b7aacd0df71fd51102ed952f3b6664fb50a/lib/Interfaces/Object/FollowInterface.php#L180

Actual issue was fixed in peertube code 3 days ago https://github.com/Chocobozzz/PeerTube/commit/de94ac86a211dec657332d964693857ec235ce40 so after next update of mentioned peertube instances it should start to work with Nextcloud Social

mnd commented 3 years ago

For pirati.ca I suppose #659 feature should fix the issue for you.