gugray / rss-parrot

Notifies Mastodon accounts about new posts in the RSS feeds they follow
https://rss-parrot.net
MIT License
109 stars 7 forks source link

No response to request from GoToSocial #26

Closed kvibber closed 5 months ago

kvibber commented 7 months ago

If I send a message to RSS parrot from a GoToSocial account, I never get a response from the bot.

Logs from the GTS side suggest that RSS Parrot doesn't like the formatting of the request. Messages from GTS to other platforms like Mastodon do work, so I'm guessing it's a parse issue and not a generating issue.

I'll see about getting some more detail logs including what GoToSocial is sending.

timestamp="11/01/2024 02:47:13.361" func=federation.(*federatingActor).Send level=INFO requestID=rtj6nxmc04001n481h4g msg="send activity Create via outbox https://gts.keysmash.xyz/users/kelsonv/outbox"
timestamp="11/01/2024 02:47:13.366" func=httpclient.(*Client).DoSigned level=INFO method=POST url=https://rss-parrot.net/inbox requestID=rtj6nxmc04001n481h4g pubKeyID=https://gts.keysmash.xyz/users/kelsonv/main-key msg="performing request"
timestamp="11/01/2024 02:47:13.581" func=workers.(*clientAPI).CreateStatus level=ERROR requestID=rtj6nxmc04001n481h4g msg="error federating status: CreateStatus: error sending Create activity via outbox https://gts.keysmash.xyz/users/kelsonv/outbox: func1: error delivering to https://rss-parrot.net/inbox: deliver: POST request to https://rss-parrot.net/inbox failed: status=\"400 Bad Request\" body=\"{\"error\":\"Request body is not valid JSON\",\"status\":400}\n\""
gugray commented 7 months ago

Thanks for the useful details! I found the trace of this request in the log. The problem is that my data model treats the "to" and "cc" fields as arrays; that is what I have always seen from Mastodon. In the request from GoToSocial, the "to" field's value is a string.

I'm trying to track this down (not because I want to be "right" but to understand what's going on). So far I cannot find a single document with a formal specification of what is a valid Activity, the acceptable types of each field etc... I've seen this JSON polymorphism elsewhere (in "object") and in all honesty this is driving me crazy.

But, I'll stop whining and return to doing what I did with the Parrot all along: undestand the protocol through good old trial-and-error.

kvibber commented 7 months ago

Ugh, I see what you mean. I just spent more time than I should looking through the vocab doc and can't find any indication of whether single-item parameters should be just the items or single-item arrays. Though there are a couple of single-item "to" examples buried in a non-normative section, so even if it doesn't say so, it at least has an example that matches GoToSocial's interpretation.

gugray commented 7 months ago

Thanks for looking into this too! I didn't mean to say GoToSocial was doing anything wrong; it's just hard to figure out some of the details about ActivityPub. Any case, if to/cc is used either as an array or a string in the wild, that's what the parrot will need to get used to :)

gugray commented 7 months ago

Also @kvibber can you give me access to a GoToSocial instance? I don't seem to find any directory, hence also no instance where I could sign up.

kvibber commented 7 months ago

@gugray Sorry it took a while to get back to you. Yes, I can set up a test account for you on my test instance, gts.keysmash.xyz. It's not open for public signups, so let me know how I should send you the login info.

gugray commented 6 months ago

Sorry, now I've been focusing on other things. Could you do these two things?

1: Check if the problem is still there. I already made parsing this JSON more robust back in January; unless there are other issues too, it should already work!

2: If the problem is there, I'd like an account with the Parrot's email, rss.parrot@gmail.com

Thanks~

kvibber commented 6 months ago

Interesting: I'm still not able to follow an RSS-Parrot-generated account from GTS or get a reply from @ birb, but I'm seeing a different error now:

timestamp="23/02/2024 04:47:49.083" func=server.glob..func1.Logger.func13.1 level=INFO latency="271.219µs" userAgent="RSS-Parrot-Bot/0.0.57 (+https://rss-parrot.net)" method=GET statusCode=406 path=/users/kelsonv/main-key clientIP=64.176.202.191 pubKeyID=https://rss-parrot.net/u/birb#main-key errors="Error #01: no format can be offered for requested Accept header(s) [application/json]; this endpoint offers [application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\" application/activity+json text/html]\n" requestID=be0mnn4d04000vfe7ry0 msg="Not Acceptable: wrote 186B"

It looks like another case where GoToSocial is more strictly enforcing the spec than most AP software. So requesting one of these types should fix that part:

I'll set up that test account for you and send the login info to that email address.

kvibber commented 6 months ago

I found another log entry that looks relevant:

timestamp="23/02/2024 04:47:21.121" func=dereferencing.(*Dereferencer).enrichAccount level=ERROR requestID=v89mnn4d040017ssgt7g msg="error webfingering[1] remote account birb@rss-parrot.net: fingerRemoteAccount: error webfingering @birb@rss-parrot.net: Finger: non webfinger type response: application/activity+json; charset=utf-8"

It took some digging to find what it was expecting, but apparently webfinger is supposed to respond with application/jrd+json

kvibber commented 6 months ago

OK, I've set up the test account and emailed the info to rss.parrot@gmail.com. Let me know if you have any problems connecting to it!

gugray commented 5 months ago

Changes from latest commit:

What works now:

What does not work:

kvibber commented 5 months ago

Thanks yet again for helping with this!

Interestingly, my own account is able to get a reply from birb when mentioning it in a public or unlisted post, so I'm not sure why it didn't work with the test account. Maybe they have different settings.

While I'm at it, I decided to check against Snac2, which is another small-scale ActivityPub server I'm also testing. And it seems to work fine there too.

gugray commented 5 months ago

For now I'm inclined to consider this solved! If any anomalies come up, we can deal with those in separate issues.

Thanks for your help and insights in untangling this!