rafaelmardojai / forge-sparks

Get git forges notifications
MIT License
70 stars 9 forks source link

[bug] Keep Running in Background shows "Request Failed" #14

Closed fnune closed 1 year ago

fnune commented 1 year ago

image

If I run via CLI I don't really see any logs related to it:

flatpaflatpak run com.mardojai.ForgeSparks 
Gjs-Message: 09:48:30.329: JS LOG: Forge Sparks: com.mardojai.ForgeSparks
Gjs-Message: 09:48:30.329: JS LOG: Version: 0.2.0
Gjs-Message: 09:48:30.923: JS LOG: https://api.github.com/notifications response resulted in 200

I'm on GNOME 44.5.

rafaelmardojai commented 1 year ago

I probably could add more hints to the error, but it basically means that the portal is rejecting the background permission request (or xdp-desktop-portal is not even installed).

Speaking technically, ff no error is print in CLI then it means that the portal simply returned a false for the request or an Gio.IOErrorEnum.CANCELLED error was raised (in this context it means that the user cancelled the request).

Could you try going to GNOME Settings > Applications > Forge Sparks and see if the background permission is active? If is disabled enabled it and try again in the app.

fnune commented 1 year ago
=> sudo apt install xdg-desktop-portal
[sudo] password for fausto:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
xdg-desktop-portal is already the newest version (1.18.0-1).
xdg-desktop-portal set to manually installed.

It was installed, it seems.

Looks like the permission was enabled:

image

rafaelmardojai commented 1 year ago

Hmm, seems odd. I can reproduce the failure If I disable Run in Background in GNOME Settings and it works again after re-enabling.

If it fails for you, then something strange is happening. You could try using Flatseal and use its reset permission button in Forge Sparks to fix any possible weirdness.

fnune commented 1 year ago

I installed Flatseal and reset the permissions for Forge Sparks, and then gave it back the Background permission. The problem persists.

Happy to provide more technical info, but I don't know where to look to for logs.

rafaelmardojai commented 1 year ago

Thanks, seems a hard thing to debug 😅.

Can you give me info about your system setup? So I can try to setup a virtual machine and see if the problem is reproducible from there.

fnune commented 1 year ago

Debian sid:

=> uname -a
Linux melian 6.5.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.3-1 (2023-09-13) x86_64 GNU/Linux

=> cat /etc/apt/sources.list
deb http://deb.debian.org/debian/ sid main non-free-firmware contrib
deb-src http://deb.debian.org/debian/ sid main non-free-firmware contrib

I installed Flatpak/Flathub like so:

sudo apt install -y flatpak gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fnune commented 1 year ago

Forgot about this:

=> echo $XDG_SESSION_TYPE
x11
fnune commented 1 year ago

I'm sure you already have this in mind, but just to be on the same page: https://github.com/rafaelmardojai/forge-sparks/blob/5e367671dd3e1f94eedcba8745a1e38e9bdfe823/src/util.js#L40-L75

Perhaps e.code === Gio.IOErrorEnum.CANCELLED but the message is still interesting.

rafaelmardojai commented 1 year ago

Well, installed Debian, flatpak and Forge Sparks and everything worked fine.

The only likely difference with your setup is that I updated to sid after testing because I totally forgot 😅. But things still worked.

So this is really weird... Do you have xdg-desktop-portal-gnome installed right? I'm out of ideas. Have you tried uninstalling and installing it back removing ~/.var/app/com.mardojai.ForgeSparks in the process?

rafaelmardojai commented 1 year ago

Btw, also tried in the X11 session and all was fine.

fnune commented 1 year ago

Okay! Installing xdg-desktop-portal-gnome and restarting my computer fixed it!

To confirm, I uninstalled the package and rebooted again, and Forge Sparks was broken.

Now I'm wondering why this package wasn't part of my installation from the beginning. This computer's Gnome was installed using the system installer that ships with Debian...

fnune commented 1 year ago

Thank you for helping me figure this out.