Argggh, I can't figure out why #Mastodon doesn't seem to understand that I've accepted the Follow activity!!

Using the explorer it SEEMS like the body is correct, and the fact that it (a) accepts it without showing an error in the explorer and (b) returns a 202 status for the POST indicates that it SHOULD have worked... but it hasn't!!!

Genuinely losing my mind over this lol

#activitypub #activitypubdev #helpneeded

I fixed it.

The issue was that the remote follow activity got a response AFTER I POSTed the accept activity. That was because my logic handler for the request went like this:

1. Parse the remote follow activity to remove the @ context key
2. Craft the accept activity body
3. Fetch the remote actors inbox
4. POST the accept activity to the inbox
5. Send the response to the remote follow activity

You have to send the response to the remote follow activity before you POST the accept activity 🤦‍♂️

@exerra I think most people are processing activities asynchronously. That is, putting the activity on a queue and sending the HTTP 202 reply, then separately, dequeuing the activity and acting on it.

It looks like Mastodon actually requires you to do this - which I never realised until now.

Welcome to the implementers' club :)

@FenTiger I'd like a queue, however I am implementing AP in a site that will be deployed on a serverless platform. So, basically, very limited in what I can do. Everything has to happen within that one handler (unless I make a queue CF worker, hmmm).

I solved it by making an async function with a slight delay that gets called, without await, right before the response is returned as due to limitations I can't do anything after the response.

Also, thanks, is there a badge of honour one can get 😅