ckolderup / postmarks

a single-user bookmarking website designed to live on the Fediverse
https://postmarks.glitch.me
MIT License
464 stars 38 forks source link

glitch instance can't be followed or follow other fedi users #132

Closed miguelarbesu closed 9 months ago

miguelarbesu commented 1 year ago

Hello! First of all, thanks for creating this project :D The issue I'm reporting probably regards deployment, so feel free to close it if it's not relevant here.

I have a Postmark instance forked in glitch that I can't find from my mastodon account in mstdn.social. Conversely, I can't follow other users (e.g. myself) from the admin section -- I get a Couldn't process follow request error.

Because of the first error I thought that the project sleep policy in Glitch was responsible for the issue, but the second one made me doubt. Any idea?

Thanks!

TomCasavant commented 1 year ago

Did you set the PUBLIC_BASE_URL=miguelarbesu-bookmark-stream.glitch.me? The README seems to imply you don't have to for glitch projects so there's probably something in there that detects the current project name, but I'm not sure if that breaks when you change the project from its default.

If you add some logs to https://github.com/ckolderup/postmarks/blob/d1e24bd0ec514376ccf8e1064c075ddff92cf531/src/routes/admin.js#L201 in your glitch project you might be able to figure out if it's just something wrong with your account.json or something

TomCasavant commented 1 year ago

I just ran into a similar issue after pulling in some updates to glitch, but just setting the account.json file to the previous values worked

miguelarbesu commented 12 months ago

Thanks for the help @TomCasavant ! Indeed, I had not set the PUBLIC_BASE_URL. Now it's done, but I still can't follow/ be followed. I'm completely new to JS, so I'll have to dig in the logging options a bit. I'llfollow up if I get to sort it out :)

ckolderup commented 12 months ago

thanks for talking through this, folks-- the intention is that Glitch projects should be reading from the environment variable that gets set in all Glitch project containers. If that's not happening, it's a regression that I probably introduced when I added support for PUBLIC_BASE_URL.

TomCasavant commented 12 months ago

Sorry, looping back to this. If you haven't found a solution yet, I just noticed that visiting your site it does that 'waking up' thing which I don't think should be happening if the server is functioning correctly, I think since it's running the activitypub server it should keep it awake non-stop. So, it might be worth re-pulling the project/setting up the account.json unless you've made some custom changes on your end

miguelarbesu commented 11 months ago

Thanks @TomCasavant ! The policy for Glitch's starter plan (i.e. free tier) is sleep after 5 min, in order to keep resources low: https://glitch.com/pricing. So perhaps that's where the problem is coming from.

TomCasavant commented 11 months ago

Thanks @TomCasavant ! The policy for Glitch's starter plan (i.e. free tier) is sleep after 5 min, in order to keep resources low: https://glitch.com/pricing. So perhaps that's where the problem is coming from.

I'm on the free tier, I don't think mine has ever gone to sleep

But @ckolderup might have more insight on how that works

TomCasavant commented 11 months ago

If you get a chance could you just pull up the logs in glitch and see what happens when you load the site, and then try to add a bookmark or follow a user and see if/what error is showing up or maybe any unusual logs, because I expect an error is forcing the server to close occasionally (that's what would happen when I was messing around with some of the server.js file)

miguelarbesu commented 11 months ago

Sure! Here is the log when I search the name from Mastodon:

[2023-11-4 9:11:22] GET:/.well-known/webfinger?resource=acct:bookmarks@miguelarbesu-bookmark-stream.glitch.me 200 0.003ms

[2023-11-4 9:11:22] GET:/.well-known/webfinger?resource=acct:miguelarbesu@miguelarbesu-bookmark-stream.glitch.me 200 0.005ms

[2023-11-4 9:11:23] GET:/u/miguelarbesu 200 0.004ms

Loading the site (already running, as I am logged in in Glitch:

[2023-11-4 9:13:13] GET:/ 200 0.004ms

Try following another user (both using @user@isntance and https://instance/@user):

[2023-11-4 9:20:45] POST:/admin/following/follow 200 0.003ms

couldn't look up canonical actor info

Invalid URL

Adding a bookmark:


[2023-11-4 9:15:53] GET:/bookmark/new 200 0.003ms

[2023-11-4 9:16:19] GET:/bookmark/popup?url=https%3A%2F%2Felpais.com%2Fsalud-y-bienestar%2F2023-11-03%2Fklaus-pantel-oncologo-con-los-analisis-de-sangre-podemos-encontrar-senales-del-regreso-del-tumor-meses-antes-de-que-el-radiologo-pueda-verlo.html&highlight= 200 0.002ms

[2023-11-4 9:16:57] POST:/bookmark/?ephemeral=true 200 0.003ms

%5B%22research%22%2C%22cancer%22%5D

sending this message to all followers: {"@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1"],"id":"https://miguelarbesu-bookmark-stream.glitch.me/m/9af3e4b6cf60f8f47614c04f2eebcd4f","type":"Create","actor":"https://miguelarbesu-bookmark-stream.glitch.me/u/bookmarks","to":["https://miguelarbesu-bookmark-stream.glitch.me/u/bookmarks/followers/","https://www.w3.org/ns/activitystreams#Public"],"object":{"@context":"https://www.w3.org/ns/activitystreams","id":"https://miguelarbesu-bookmark-stream.glitch.me/m/90e5d946f8f6342b78920f5c5a33b6c1","type":"Note","published":"2023-11-04T09:16:57.746Z","attributedTo":"https://miguelarbesu-bookmark-stream.glitch.me/u/bookmarks","content":"\n      <strong><a href=\"https://elpais.com/salud-y-bienestar/2023-11-03/klaus-pantel-oncologo-con-los-analisis-de-sangre-podemos-encontrar-senales-del-regreso-del-tumor-meses-antes-de-que-el-radiologo-pueda-verlo.html\">Klaus Pantel, oncólogo: “Con los análisis de sangre podemos encontrar señales del regreso del tumor meses antes de que el radiólogo pueda verlo”</a></strong><br/>\n      \"El director del Instituto de Biología Tumoral de Hamburgo habla de las posibilidades de la biopsia líquida para detectar el cáncer en etapas tempranas o saber si alguien está curado tras una cirugía \"","to":["https://miguelarbesu-bookmark-stream.glitch.me/u/bookmarks/followers/","https://www.w3.org/ns/activitystreams#Public"],"tag":[{"type":"Hashtag","href":"https://miguelarbesu-bookmark-stream.glitch.me/tagged/research","name":"#research"},{"type":"Hashtag","href":"https://miguelarbesu-bookmark-stream.glitch.me/tagged/cancer","name":"#cancer"}]}}

[2023-11-4 9:16:57] POST:/u/bookmarks/inbox 200 0.003ms

Sent message to an inbox at miguelarbesu-bookmark-stream.glitch.me!

Response Status Code: 404

Response body: <!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8">

<title>Error</title>

</head>

<body>

<pre>Cannot POST /u/bookmarks/inbox</pre>

</body>

</html>
TomCasavant commented 11 months ago

[2023-11-4 9:11:22] GET:/.well-known/webfinger?resource=acct:bookmarks@miguelarbesu-bookmark-stream.glitch.me 200 0.003ms [2023-11-4 9:11:22] GET:/.well-known/webfinger?resource=acct:miguelarbesu@miguelarbesu-bookmark-stream.glitch.me 200 0.005ms [2023-11-4 9:11:23] GET:/u/miguelarbesu 200 0.004ms

This looks like it successfully requested the resource but then didn't look for account information(?)

Sent message to an inbox at miguelarbesu-bookmark-stream.glitch.me! Response Status Code: 404

is your bookmark following itself?

I looked into some of the webfinger results and it looks like it's successfully finding the account information image It looks like it directs all information to /u/bookmarks/outbox etc. instead of /u/miguelarbesu/outbox which is interesting I assume you started with the username @bookmarks? and then changed that later after your first build? I don't think that would be causing your issues though, but if it is try going through this process again from the README:

either rename account.json.example to account.json, or copy the contents into a new file called account.json. Whatever username you have in this file when the project first starts you'll need to retain or else you'll break your followers' connection to this account.

Then this is the weirdest issue

[2023-11-4 9:20:45] POST:/admin/following/follow 200 0.003ms couldn't look up canonical actor info Invalid URL

I'm not sure what's going on here, the only time I could find "Invalid URL" as an error message is when creating/updating a bookmark

How difficult would it be for you to update your glitch code to the latest updates? If you haven't changed any of the code yourself it should just be clicking on Tools (at the bottom) -> import from github -> ckolderup/postmarks, @ckolderup said he would be figuring out a guide or something for pulling in updates but I'm not sure if that exists yet. My best guess is it's something to do with the mapping of /u/miguelarbesu to /u/bookmarks (it looks like everything is associated with @bookmarks, but searching for that user doesn't seem to work either so I don't know)

miguelarbesu commented 10 months ago

Hi, sorry for the delay in replying!

jennschiffer commented 9 months ago

@miguelarbesu I ran into this issue tonight and I saw that the original glitch project name was in the activitypub.db file - so i opened the glitch terminal and ran rm .data/activitypub.db and then refresh and after the site rebuilt, the activitypub.db was recreated but with my chosen project name. then i was able to follow it on mastodon.

miguelarbesu commented 9 months ago

Thanks a lot @jennschiffer, that did the trick! Closing the issue :)