Follow requests not accepted

I’ve set up ActivityPub plugin, but I cannot follow the actors I’ve set up on my instance from any other fedi app. When I try to follow:

news@forum.internet-czas-dzialac.pl

from a Mastodon client, and refresh the mastodon UI, the follow request is stuck:

It’s been stuck at “withdraw follow request” for hours now. Canceling and sending a follow request again does not help, it still gets stuck and does not get informed about new posts in the category

1 Like

I can reproduce, though I see a slightly different UI:

Can you try How to debug connectivity issues with ActivityPub see if any of that helps?

1 Like
  1. No geoblocker configured on my server
  2. Disabling requiring signed requests in the plugin settings at admin/site_settings/category/all_results?filter=plugin%3Adiscourse-activity-pub did not resolve the issue
  3. I"m seeing the following warnings in the logs:
[Discourse Activity Pub] Failed to process https://mastodon.social/users/Ifutig#delete: Object is not ready




[Discourse Activity Pub] DiscourseActivityPub::AP::Handlers::Warning
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `block in warn'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `block in dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `each'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `warn'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/logger.rb:26:in `log'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/logger.rb:63:in `warn'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:42:in `rescue in block in perform_transactions'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:35:in `block in perform_transactions'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:616:in `block in within_new_transaction'
activesupport-7.2.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:613:in `within_new_transaction'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:361:in `transaction'
activerecord-7.2.2.1/lib/active_record/transactions.rb:234:in `block in transaction'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:415:in `with_connection'
activerecord-7.2.2.1/lib/active_record/connection_handling.rb:296:in `with_connection'
activerecord-7.2.2.1/lib/active_record/transactions.rb:233:in `transaction'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:34:in `perform_transactions'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:26:in `process'
/var/www/discourse/plugins/discourse-activity-pub/app/jobs/discourse_activity_pub_process.rb:14:in `block in execute'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/plugins/discourse-activity-pub/app/jobs/discourse_activity_pub_process.rb:8:in `execute'
/var/www/discourse/app/jobs/base.rb:316:in `block (2 levels) in perform'
rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/app/jobs/base.rb:303:in `block in perform'
/var/www/discourse/app/jobs/base.rb:299:in `each'
/var/www/discourse/app/jobs/base.rb:299:in `perform'
sidekiq-7.3.9/lib/sidekiq/processor.rb:220:in `execute_job'
sidekiq-7.3.9/lib/sidekiq/processor.rb:185:in `block (4 levels) in process'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:180:in `traverse'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:183:in `block in traverse'
/var/www/discourse/lib/sidekiq/pausable.rb:132:in `call'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:182:in `traverse'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:183:in `block in traverse'
sidekiq-7.3.9/lib/sidekiq/job/interrupt_handler.rb:9:in `call'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:182:in `traverse'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:183:in `block in traverse'
sidekiq-7.3.9/lib/sidekiq/metrics/tracking.rb:26:in `track'
sidekiq-7.3.9/lib/sidekiq/metrics/tracking.rb:134:in `call'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:182:in `traverse'
sidekiq-7.3.9/lib/sidekiq/middleware/chain.rb:173:in `invoke'
sidekiq-7.3.9/lib/sidekiq/processor.rb:184:in `block (3 levels) in process'
sidekiq-7.3.9/lib/sidekiq/processor.rb:145:in `block (6 levels) in dispatch'
sidekiq-7.3.9/lib/sidekiq/job_retry.rb:118:in `local'
sidekiq-7.3.9/lib/sidekiq/processor.rb:144:in `block (5 levels) in dispatch'
sidekiq-7.3.9/lib/sidekiq/config.rb:39:in `block in <class:Config>'
sidekiq-7.3.9/lib/sidekiq/processor.rb:139:in `block (4 levels) in dispatch'
sidekiq-7.3.9/lib/sidekiq/processor.rb:281:in `stats'
sidekiq-7.3.9/lib/sidekiq/processor.rb:134:in `block (3 levels) in dispatch'
sidekiq-7.3.9/lib/sidekiq/job_logger.rb:15:in `call'
sidekiq-7.3.9/lib/sidekiq/processor.rb:133:in `block (2 levels) in dispatch'
sidekiq-7.3.9/lib/sidekiq/job_retry.rb:85:in `global'
sidekiq-7.3.9/lib/sidekiq/processor.rb:132:in `block in dispatch'
sidekiq-7.3.9/lib/sidekiq/job_logger.rb:40:in `prepare'
sidekiq-7.3.9/lib/sidekiq/processor.rb:131:in `dispatch'
sidekiq-7.3.9/lib/sidekiq/processor.rb:183:in `block (2 levels) in process'
sidekiq-7.3.9/lib/sidekiq/processor.rb:182:in `handle_interrupt'
sidekiq-7.3.9/lib/sidekiq/processor.rb:182:in `block in process'
sidekiq-7.3.9/lib/sidekiq/processor.rb:181:in `handle_interrupt'
sidekiq-7.3.9/lib/sidekiq/processor.rb:181:in `process'
sidekiq-7.3.9/lib/sidekiq/processor.rb:86:in `process_one'
sidekiq-7.3.9/lib/sidekiq/processor.rb:76:in `run'
sidekiq-7.3.9/lib/sidekiq/component.rb:10:in `watchdog'
sidekiq-7.3.9/lib/sidekiq/component.rb:19:in `block in safe_thread'


  1. activity pub allowed request origins and activity pub blocked request origins settings are empty

Mastodon’s sidekiq reports this error for ActivityPub::DeliveryWorker queue called with arguments

"{\"@context\":\"https://www.w3.org/ns/activitystreams\",\"id\":\"https://toot.kuba-orlik.name/users/kuba#follows/2702/undo\",\"type\":\"Undo\",\"actor\":\"https://toot.kuba-orlik.name/users/kuba\",\"object\":{\"id\":\"https://toot.kuba-orlik.name/afe35800-107b-4843-baf6-763052aa8a79\",\"type\":\"Follow\",\"actor\":\"https://toot.kuba-orlik.name/users/kuba\",\"object\":\"https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366\"}}", 1, "/inbox"
HTTP::Request::UnsupportedSchemeError: unknown scheme: on /inbox

It looks like maybe ap_id is empty in this fragment?


Yes, I can see that

curl -H "Accept: application/activity+json" https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366 | jq

returns:

{
  "id": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366",
  "type": "Group",
  "updated": "2025-03-14T12:23:02Z",
  "url": "https://forum.internet-czas-dzialac.pl/c/nowinki-od-icd/65",
  "name": "Forum ICD - Newsy",
  "inbox": "/inbox",
  "outbox": "/outbox",
  "followers": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366/followers",
  "preferredUsername": "news",
  "publicKey": {
    "id": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366#main-key",
    "owner": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2JFbVH7kIfa/14CDnUww\n9x+XwOPsS0qyeec1jdasv8SqqCit22FwDsLhH6vWpSIDisEDOhTLZjFFtpwksA8d\nRZIdOFrFazPkUF69J5VDVGtLgjyRi/KkJewbVaUnxO8zNwnxyBYWe8QoMWbdFwto\nfNzvB/ht+9Pch8ksVzNPnrA3Z7egtWHWGNl5sQ+8eXOKzeMNOn73hCEKcOSPWulz\n1gbbdo0So5ThKpwXC0ViqcZy2yzyTFptdrvL7lphr0BywUsG6AruOuwmghw6eRNe\nFvzx0Pq01bUIyY+MXiYmN6sLMIDqi/kdoALzSE+tHcv7HzCLNuEJb1DCmZo56O2H\nSQIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  "icon": {
    "type": "Image",
    "mediaType": "image/png",
    "url": "https://forum.internet-czas-dzialac.pl/uploads/default/original/1X/adbc19ebc6466183dc0387c3f59d86bd2861b5c9.png"
  },
  "@context": "https://www.w3.org/ns/activitystreams"
}

You can see that the inbox and outbox URLs do not have the protocol and the domain

2 Likes

I think I’ve found the issue. I’ve sent a PR that fixes this:

The gist of the change is adding these getters:

1 Like

Your issue is that objects are somehow being created with ids in the first place. It’s not related to the serializer (or the fabricator). Could you please share:

  1. The environment of your discourse, i.e. how you’re hosting, and what version of Discourse you’re using.
  2. Any other plugins you’re using.

@kuba-orlik Your issue is likely caused by this PR

This should address it:

Thanks for reporting the issue, and for your patience!

1 Like

Thanks @angus for looking into it! Unfortunately, Even with latest version, the issue persists.

I’m self-hosting using the official docker setup (./launcher rebuild app).

I’m running Discourse 3.5.0.beta2-dev

discourse-chat-integration, discourse-whos-online, discourse-telegram-notifications, discourse-assign

I did think that this might be the case, but I had tried installing versions prior to this commit, and I had the same issue :thinking:

I’ve installed the latest version of the plugin (from commit 0083654), and unfortunately the issue is not fixed. A quick check:

> curl -H "Accept: application/activity+json" https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366 | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1298    0  1298    0     0   9151      0 --:--:-- --:--:-- --:--:--  9205
{
  "id": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366",
  "type": "Group",
  "updated": "2025-03-14T12:23:02Z",
  "url": "https://forum.internet-czas-dzialac.pl/c/nowinki-od-icd/65",
  "name": "Forum ICD - Newsy",
  "inbox": "/inbox",
  "outbox": "/outbox",
  "followers": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366/followers",
  "preferredUsername": "news",
  "publicKey": {
    "id": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366#main-key",
    "owner": "https://forum.internet-czas-dzialac.pl/ap/actor/3120ea9df156a8556848a862fc980366",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2JFbVH7kIfa/14CDnUww\n9x+XwOPsS0qyeec1jdasv8SqqCit22FwDsLhH6vWpSIDisEDOhTLZjFFtpwksA8d\nRZIdOFrFazPkUF69J5VDVGtLgjyRi/KkJewbVaUnxO8zNwnxyBYWe8QoMWbdFwto\nfNzvB/ht+9Pch8ksVzNPnrA3Z7egtWHWGNl5sQ+8eXOKzeMNOn73hCEKcOSPWulz\n1gbbdo0So5ThKpwXC0ViqcZy2yzyTFptdrvL7lphr0BywUsG6AruOuwmghw6eRNe\nFvzx0Pq01bUIyY+MXiYmN6sLMIDqi/kdoALzSE+tHcv7HzCLNuEJb1DCmZo56O2H\nSQIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  "icon": {
    "type": "Image",
    "mediaType": "image/png",
    "url": "https://forum.internet-czas-dzialac.pl/uploads/default/original/1X/adbc19ebc6466183dc0387c3f59d86bd2861b5c9.png"
  },
  "@context": "https://www.w3.org/ns/activitystreams"
}

You can see that again the inbox and outbox keys are not complete URLs

1 Like

Going back to a previous commit would not have helped once the issue presented. Please try re-saving the actors in Admin > ActivityPub, i.e. click "Save Actor" in /admin/plugins/ap/actor.

1 Like

Ah! I re-saved the category actors and it works!

Now, how do I fix individual user actors, like https://forum.internet-czas-dzialac.pl/ap/actor/0098dcca74e34cfd2115e9309a7d4531?

> curl -H "Accept: application/activity+json" https://forum.internet-czas-dzialac.pl/ap/actor/0098dcca74e34cfd2115e9309a7d4531 | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1332    0  1332    0     0   9273      0 --:--:-- --:--:-- --:--:--  9314
{
  "id": "https://forum.internet-czas-dzialac.pl/ap/actor/0098dcca74e34cfd2115e9309a7d4531",
  "type": "Person",
  "updated": "2025-03-14T12:34:26Z",
  "url": "https://forum.internet-czas-dzialac.pl/u/kuba",
  "name": "Kuba",
  "inbox": "/inbox",
  "outbox": "/outbox",
  "sharedInbox": "https://forum.internet-czas-dzialac.pl/ap/users/inbox",
  "followers": "https://forum.internet-czas-dzialac.pl/ap/actor/0098dcca74e34cfd2115e9309a7d4531/followers",
  "preferredUsername": "kuba",
  "publicKey": {
    "id": "https://forum.internet-czas-dzialac.pl/ap/actor/0098dcca74e34cfd2115e9309a7d4531#main-key",
    "owner": "https://forum.internet-czas-dzialac.pl/ap/actor/0098dcca74e34cfd2115e9309a7d4531",
    "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0wp46cDyUbUUTfvbWqy/\nRS3YXY2g69+a3R5n+f4EeCxcpNL1OGPyzgjszdoxAWLSXCHqZk91v2rvpfRZt8wi\nEQ8Sr5CVj1uKIny9bdxKtxVyiT7U1pIZGD1VhWXqY1tMRLxQWWhA2+UtD1pfFzk/\nyqcbqXUvlG6UsQBAlDnaPxKaq3CD1ui1ANVsVY+VEbJyROIVY3q86qw50KSDHu/y\n0TaD6UjZNtnGOVmjh11QZwn2j5A/GYj6gqFDdS58KMMoBuPAfRZ7uD3psJ5CqT6F\nKLwn5q3UvypEm89SmboRIEcq7Pcvv1Zts0QJRDaSA0M4VeW35iuAqnhQ7yHKthAF\nYwIDAQAB\n-----END PUBLIC KEY-----\n"
  },
  "icon": {
    "type": "Image",
    "mediaType": "image/png",
    "url": "https://forum.internet-czas-dzialac.pl/user_avatar/forum.internet-czas-dzialac.pl/kuba/96/1866_2.png"
  },
  "@context": "https://www.w3.org/ns/activitystreams"
}
1 Like

Glad it’s working!

The current data verification checks will apply whenever a user is involved in an actual activity (i.e. it will self-rectify when needed), nevertheless it is a good idea to extend the same verification checks on direct person actor access like you’re doing here. This will do that:

Thanks for persevering with this. It’s very helpful to have a real instance with incorrect data to ensure the verification checks work as expected, and as needed. The original data corruption issue that led to these recent changes could happen again in some other form, so the goal here is to ensure ongoing data consistency at the point the data is needed (as opposed to handling it through migrations etc). Let me know you see any similar issues!

2 Likes

It works now! Switching to your fork for now :slight_smile:

1 Like

@angus thank you for your support so far. Although the inbox/outbox URLs look OK now, following still does not work. I’ve tried following @kuba@forum.internet-czas-dzialac.pl from two different Mastodon instances, and it failed in both cases.

I’m getting this error when submitting a follow request for a regular user actor:

[Discourse Activity Pub] Failed to process https://mastodon.internet-czas-dzialac.pl/6bef64d0-c8ad-473c-85f6-d3fd190b5ebd: 
Activity is not supported for actor and object

activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `block in warn'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `block in dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `each'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `warn'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/logger.rb:26:in `log'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/logger.rb:63:in `warn'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/object.rb:140:in `process_failed'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:139:in `process_actor_and_object'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:56:in `process_activity'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:36:in `block in perform_transactions'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:616:in `block in within_new_transaction'
activesupport-7.2.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:613:in `within_new_transaction'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:361:in `transaction'
activerecord-7.2.2.1/lib/active_record/transactions.rb:234:in `block in transaction'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `with_connection'
activerecord-7.2.2.1/lib/active_record/connection_handling.rb:296:in `with_connection'
activerecord-7.2.2.1/lib/active_record/transactions.rb:233:in `transaction'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:34:in `perform_transactions'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:26:in `process'
/var/www/discourse/plugins/discourse-activity-pub/app/jobs/discourse_activity_pub_process.rb:14:in `block in execute'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
(...)

And this when udoing a follow request:

[Discourse Activity Pub] Failed to process https://mastodon.internet-czas-dzialac.pl/users/icd#follows/5003/undo: 
Object is not ready

activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `block in warn'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `block in dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `each'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:231:in `dispatch'
activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:130:in `warn'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/logger.rb:26:in `log'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/logger.rb:63:in `warn'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/object.rb:140:in `process_failed'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:137:in `process_actor_and_object'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:56:in `process_activity'
/var/www/discourse/plugins/discourse-activity-pub/lib/discourse_activity_pub/ap/activity.rb:36:in `block in perform_transactions'
activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:616:in `block in within_new_transaction'
(...)

The second warning, i.e. this

Failed to process Internet. Czas działać! 🌎 (@icd@mastodon.internet-czas-dzialac.pl) - Fundacja Internet. Czas działać! - serwer Mastodona
Object is not ready

is expected, as you can’t Undo something that hasn’t been done.

As to why the follow isn’t working

Failed to process https://mastodon.internet-czas-dzialac.pl/6bef64d0-c8ad-473c-85f6-d3fd190b5ebd: Activity is not supported for actor and object

This suggests to me that you’re trying to follow a non-standard actor. That warning is thrown when a type validation fails. You can see the various Actor types we support in this folder:

Also that url doesn’t seem to resolve to anything.

That’s strange - I’m just trying to follow a regular person actor. The logs in here are for me trying to follow @kuba@forum.internet-czas-dzialac.pl (thinking that it corresponds to Profile - kuba - Forum Internet. Czas działać! - unless I’m mistaking something?)

From what I gather from discourse-activity-pub/lib/discourse_activity_pub/ap/actor/person.rb at main · discourse/discourse-activity-pub · GitHub, following Discourse users over AP is supported, right?

No, it is. Following Discourse actors, who are categories or tags, are supported. Users of a forum can’t be followed via ActivityPub. Those are ”pseudo users” whos post category/tag actor is boosting.

Ah, got it. Are there plans to bring support to following particular users? I’d gladly help

Ah I see, yes that’s not supported currently.

Not in the short to medium term.