Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feeds Refresh seems to be broken and PHP issuing warnings about missing keys. #269

Open
alecmuffett opened this issue Nov 8, 2023 · 16 comments

Comments

@alecmuffett
Copy link
Contributor

So I set up a WP ActivityPub/Friends instance last night, and subscribed ~120 feeds to it.

Apart from the initial load of articles upon subscription, no feeds are refreshing and they are all stale unless individually refreshed.

2023/11/07 23:01:57 [error] 985#985: *2171 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "id" in /PATH/wordpress/wp-content/plugins/friends/feed-parsers/class-feed-parser-activitypub.php on line 406" while reading upstream, client: ADDRESS, server: SITE, request: "POST /wp-admin/admin.php?page=add-friend&url=%40jennifer%40defcon.social HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "SITE", referrer: "https://SITE/wp-admin/admin.php?page=add-friend&url=%40jennifer%40defcon.social"
2023/11/07 23:05:06 [error] 985#985: *2586 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "id" in /PATH/wordpress/wp-content/plugins/friends/feed-parsers/class-feed-parser-activitypub.php on line 406" while reading upstream, client: ADDRESS, server: SITE, request: "POST /wp-admin/admin.php?page=add-friend&url=%40neil%40mastodon.neilzone.co.uk HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "SITE", referrer: "https://SITE/wp-admin/admin.php?page=add-friend&url=%40neil%40mastodon.neilzone.co.uk"
2023/11/07 23:06:31 [error] 985#985: *2802 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "id" in /PATH/wordpress/wp-content/plugins/friends/feed-parsers/class-feed-parser-activitypub.php on line 406" while reading upstream, client: ADDRESS, server: SITE, request: "POST /wp-admin/admin.php?page=add-friend&url=%40marcia%40defcon.social HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "SITE", referrer: "https://SITE/wp-admin/admin.php?page=add-friend&url=%40marcia%40defcon.social"
2023/11/07 23:06:57 [error] 985#985: *2884 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "id" in /PATH/wordpress/wp-content/plugins/friends/feed-parsers/class-feed-parser-activitypub.php on line 406" while reading upstream, client: ADDRESS, server: SITE, request: "POST /wp-admin/admin.php?page=add-friend&url=%40kottke%40botsin.space HTTP/1.1", upstream: "fastcgi://unix:/run/php/php8.1-fpm.sock:", host: "SITE", referrer: "https://SITE/wp-admin/admin.php?page=add-friend&url=%40kottke%40botsin.space"
@alecmuffett alecmuffett changed the title Feeds Refresh seems to be broken and PH Feeds Refresh seems to be broken and PHP issuing warnings about missing keys. Nov 8, 2023
@akirk
Copy link
Owner

akirk commented Nov 15, 2023

Sorry for the trouble! It looks like a two things come together here.

Thanks for quoting the requests above, it seems like these users have accounts on Mastodon servers that have "Authorized Fetch" activated, and it looks like for some reason the outgoing request was not signed. Could it be that for your blog the Rest URL is on another host? i.e. https://github.com/Automattic/wordpress-activitypub/blob/efd98acd0bf3f2c42f0ffc3d8f10920e74cb8512/includes/model/class-application-user.php#L38 returns a different host than your blog? I've learned today that Mastodon will try to do a Webfinger lookup on the URL, so for example for the code linked above returns https://alex.kirk.at/wp-json/activitypub/1.0/application upon which Mastodon queries https://alex.kirk.at/.well-known/[email protected] to get the profile URL.

The other thing is that ActivityPub "feeds" are not refreshed since they'll receive new messages through push. If you manually refresh them, it fetches their ActivityPub outbox which should have been done upon initial add (so that their page doesn't appear empty after adding them even though nothing has been yet pushed to them).

I hope this helps. Since a bit of time passed since you reported this, did you observe new items coming in?

@alecmuffett
Copy link
Contributor Author

I think you may have found it. Investigating...

@alecmuffett
Copy link
Contributor Author

Okay, so some more interesting stuff here.

I moved my ActivityPub Friends aggregation to a standalone WP instance, and decided to webfinger it per your recommendation:

IPADDR - - [15/Nov/2023:19:46:24 +0000] "GET /.well-known/webfinger?resource=acct:USER@DOMAIN HTTP/1.1" 500 297 "-" "curl/8.1.2"
IPADDR - - [15/Nov/2023:19:52:23 +0000] "GET /.well-known/webfinger?resource=acct: USER@DOMAIN HTTP/1.1" 500 297 "-" "curl/8.1.2"
2023/11/15 19:46:24 [error] 985#985: *365596 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined method WP_Error::get_url() in /big/www-elsewhere/wordpress/wp-content/plugins/activitypub/integration/class-webfinger.php:36
2023/11/15 19:52:23 [error] 985#985: *365717 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined method WP_Error::get_url() in /big/www-elsewhere/wordpress/wp-content/plugins/activitypub/integration/class-webfinger.php:36

This seems relevant. Running latest WP with full patches on latest Ubuntu LTS with PHP 8.1.2

@alecmuffett
Copy link
Contributor Author

So a WPError got passed into a routine which was expecting a User; possibly this is because the only user on the instance is the admin account and is not posting anything and/or is somehow not fully set up?

@akirk
Copy link
Owner

akirk commented Nov 15, 2023

Interesting. Looks like this is then more a problem on the ActivityPub side of things. For the USER@DOMAIN above, is the USER an existing username on your site? cc @pfefferle

@alecmuffett
Copy link
Contributor Author

Okay... so...

I have 2x WP instances: my blog, and a dedicated "friends plugin" aggregator, which is the one we are talking about here.

On that instance, I have ActivityPub Enable Blog set — in the expectation that the aggregator will never "post" anything - and I have put a token/name into the box provided, in the expectation that that would propagate. For the record (trying to keep this away from casual scrapers rather than human beings) the ID is @[email protected] where foo=='elsewhere'

I also don't have Enable Authors set, which I presume is why when I did my webfinger test against the administrator, the webfinger failed against the admin-username for the wp-instance. My bad for reporting that / forgetting that the admin user is not enabled. Webfinger of the above-cited ID, seems to work reasonably.

There are ~120 subscriptions on the aggregator, and only a mere handful of them are updating, and of those most are updating once per day. I can't easily/clearly correlate which of them are RSS vs: ActivityPub subscriptions - and for some reason RSS appears to be the default even/if/when I subscribe to a Mastodon user using the Bookmarklet when visiting their page.

@alecmuffett
Copy link
Contributor Author

Aside: maybe I should log a request for the Users page to enumerate which types of feed are enabled for each user, in a concise fashion?

@akirk
Copy link
Owner

akirk commented Nov 15, 2023

If you install the Friends debugger, there is a "Feed Log" at wp-admin/admin.php?page=friends-last-log which might be helpful but probably it's easier to download the OPML file from the Friends Settings page to get that list:

Screenshot 2023-11-15 at 21 24 44

@akirk
Copy link
Owner

akirk commented Nov 15, 2023

Trying to grasp what you wrote, I realize a better tool for double checking feeds across users would help you and be useful in general. I'll think of something and hope to provide that soon.

@alecmuffett
Copy link
Contributor Author

alecmuffett commented Nov 15, 2023 via email

@akirk
Copy link
Owner

akirk commented Nov 15, 2023

The Debug: Feed log is linked from the sidebar:
Screenshot 2023-11-15 at 21 43 16

Maybe you found this Feed Log bit in the source?
Screenshot 2023-11-15 at 21 44 29

@alecmuffett
Copy link
Contributor Author

I see different:
Screenshot 2023-11-15 at 21 00 50
Screenshot 2023-11-15 at 21 01 14

@alecmuffett
Copy link
Contributor Author

Here's a feed for 404 Media, which Friends has not updated since November 9th when I added it, but that doesn't match reality.
Screenshot 2023-11-15 at 21 04 50
Screenshot 2023-11-15 at 21 05 02

@alecmuffett
Copy link
Contributor Author

I know something has changed with respect to user handling, so is it correct for ewadmin to be the post owner?

@alecmuffett
Copy link
Contributor Author

Okay, so I accessed wp-admin/admin.php?page=friends-last-log and it says:

Feed Log
No active feeds found.

...which is worrying.

@akirk
Copy link
Owner

akirk commented Nov 17, 2023

Could you try to just go into one of the friends and check if it really is the case, and if no, try to activate the feed?

activate-feed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants