facundoolano / feedi

A personal news aggregator and Mastodon client
GNU Affero General Public License v3.0
888 stars 28 forks source link

Clicking on RSS Entries - PermissionError #21

Closed bfahrenfort closed 1 year ago

bfahrenfort commented 1 year ago

Hi,

Absolutely love the project! I'm sure this is just a routes issue, but I don't know enough about nodejs to fix it.

When browsing, if I click on an RSS entry's title, it takes me to a page that displays Error fetching article: PermissionError(13, 'Permission denied'). The daemon doesn't throw any logs from this, which I found very strange. I had a permissions issue with the filesystem around the database previously and there were very good Python error traces in journalctl from the service.

Each entry seems to have a number that's unique per-Feed assigned to it. if I'm on feed ABC, the link is https://my-domain.com/feeds/ABC/entries. When I click on an entry, the link becomes https://my-domain.com/entries/12 or similar. I've tried adding back in the feeds/ABC part to make https://my-domain.com/feeds/ABC/entries/12, but that gives a 404.

Similarly, if I'm on the homepage and click on a post from any feed, it'll give me the link https://my-domain.com/entries/12 or some other number per entry. Same PermissionError results.

facundoolano commented 1 year ago

This sounds like a permissions issue with the feedi/extract_article.js file. Can you check that the user running the app has execution permissions on that file?

bfahrenfort commented 1 year ago

Looks about right. It was readonly for the group and had no execute permissions. I did chmod 777, but now I get Error fetching article: JSONDecodeError('Expecting value: line 1 column 1 (char 0)').

I’m assuming I need to set the group write bit on some directory where the extracted articles are stored, where would that be?

facundoolano commented 1 year ago

Good, this other error I've seen when using an older node version. What version are you using?

Btw you can try the extract articles directly in the terminal passing a url. You should see some html printed if it's working correctly.

bfahrenfort commented 1 year ago

I’ll try the terminal avenue, but I followed the install guide for node 20. Is there a specific package that needs node 20? Maybe that’s out of date on my install.

bfahrenfort commented 1 year ago

nodejs --version returns v10.19.0. That can’t be right, I’ll reinstall shortly.

bfahrenfort commented 1 year ago

Installed Node 20 via NVM on the feedi user and on my user, re-ran npm i, and still getting the same json decode error.

bfahrenfort commented 1 year ago

Update: Managed to install Node 20 globally (finally), and now it works!

facundoolano commented 1 year ago

Does the script seems to work when calling from terminal at least?

I suspect that the feedi user may be picking up the OS node instead of the nvm one, but I haven't really tried that setup to be sure (I installed node 20 globally as shown in the setup script)

bfahrenfort commented 1 year ago

Feedi user is definitely ignoring nvm node. NVM runs out of the profile script of the user, so I'm assuming that systemd user specification just doesn't run the .bashrc before running the service executable.

facundoolano commented 1 year ago

Right I was going to suggest this https://github.com/nvm-sh/nvm/issues/786

I think nvm is intended for local shell override and the article script is assuming a global install. I'll try to improve the readme and see if something can be changed to make the script no ore flexible

bfahrenfort commented 1 year ago

I think the readme is fine, this was user error because I didn't follow the install guide for node 20 properly (I think I just forgot to run apt update so it only saw nodejs from the ubuntu repo).