Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get past connector instalation when using Snap or Flatpak Firefox #76

Closed
rurre opened this issue Nov 6, 2021 · 20 comments
Closed
Labels
bug Something isn't working

Comments

@rurre
Copy link

rurre commented Nov 6, 2021

Description

I've installed the extension and followed the steps as descibed on packagecloud.
The installation page is stuck on the connector installation step. I've tried restarting firefox and my computer a bunch of times.

The native program seems to be installed as it's present in /usr/libexec/firefoxpwa-connector

Additional Information

The console is full of this error
Error: Attempt to postMessage on disconnected port install.3dc3fb36.js:1:2929
d moz-extension://7d3cc388-3706-4753-bff4-c27840b220d7/setup/install.3dc3fb36.js:1
a moz-extension://7d3cc388-3706-4753-bff4-c27840b220d7/setup/install.3dc3fb36.js:1
moz-extension://7d3cc388-3706-4753-bff4-c27840b220d7/setup/install.3dc3fb36.js:1

Checking the debugger you there's also this error at the start

Promise rejected after context unloaded: Actor 'Conduits' destroyed before query 'NativeMessage' was resolved
manage.6dd94ff2.js:1
d moz-extension://7d3cc388-3706-4753-bff4-c27840b220d7/sites/manage.6dd94ff2.js:1

Environment

  • Operating system: Ubuntu 21.10
  • System architecture: x64
  • Desktop environment: Gnome 40.4.0
  • Installation method: DEB
  • FirefoxPWA extension version: 1.2.1
  • FirefoxPWA native version: 1.2.1
  • Firefox version: 94.0.1
@rurre rurre added the bug Something isn't working label Nov 6, 2021
@filips123
Copy link
Owner

Actually I think Linux on ARM isn't supported yet, because compiling the program currently relies on hardcoded Firefox download URL and I haven't found an official one for Linux on ARM. However, it's interesting that package was still installed. Can you check if firefoxpwa-connector is x86 executable or for ARM?

I plan to make automated Firefox runtime installation optional, so I will be able to build and publish ARM packages, but users will have to manually follow additional instructions to download Firefox (or do something similar as #67).

@rurre
Copy link
Author

rurre commented Nov 6, 2021

Reading that back again I realize I've actually gotten it wrong.

It's actually x64 not arm64. Whoops

@filips123
Copy link
Owner

filips123 commented Nov 7, 2021

Considering you are on Ubuntu 21.10, you are probably using the Snap version of Firefox. You can check this by going to Firefox Menu -> Help -> About Firefox and check if Snap is mentioned there.

The problem is that Ubuntu 21.10 by default uses Firefox Snap which is sandboxed and cannot access native programs. This breaks all extensions that use Native Messaging API, including FirefoxPWA and some more popular like GNOME Shell integration and KeePassXC-Browser (keepassxreboot/keepassxc-browser#1426). This cannot be fixed until Native Messaging API gets support to work in sandboxed browsers (Snap and Flatpak).

The workaround for you is to uninstall the Snap version of Firefox and install the classical DEB package as described here. But doing this will unfortunately reset all your Firefox data.

Update: Starting with Ubuntu 22.04, this will no longer work. The new workaround is in this comment.

Unfortunately, I cannot do anything to fix this. The only thing I will do in the future version is to add a warning that FirefoxPWA cannot work using Firefox Snap.

@rurre
Copy link
Author

rurre commented Nov 8, 2021

That's exactly the case. I'm using the preinstalled snap version.

I think a warning would indeed be sufficient as I tried getting this to work for quite some time and haven't seen this issue mentioned by anyone else.

@rurre rurre closed this as completed Nov 8, 2021
@black7375
Copy link

@filips123
Copy link
Owner

I added this to the current limitations and to the description on Firefox Add-ons Store.

@filips123 filips123 changed the title Can't get past connector instalation, console spammed with 'Error: Attempt to postMessage on disconnected port' Can't get past connector instalation when using Snap or Flatpak Firefox Nov 9, 2021
@filips123
Copy link
Owner

Starting with Ubuntu 22.04, the normal Firefox DEB package is replaced with a "transitional package" that just installs Snap Firefox. This means simply uninstalling Snap Firefox and installing it from APT will no longer work (since APT will also install Snap version).

The new workaround is to add the official Firefox Next PPA (which still provides proper DEB packages, at least for now) and install Firefox from there. See this for more details.

@czlucius
Copy link

Hi there
Mozilla also provides another way to install the stable version from the source tar zip file available from their website.

There are instructions here:
https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-from-mozilla-builds-for-advanced-users

And the download can be obtained here:
https://www.mozilla.org/firefox/linux

Thanks

@michael-markl
Copy link

michael-markl commented Aug 13, 2022

Is there any hope that this will work in the near future?
The problem with the native messaging through the snap container has been resolved with the keepassxc extension (see here; I can personally confirm this.

@filips123
Copy link
Owner

I think it should also work with PWAsForFirefox.

@loxK
Copy link

loxK commented Aug 14, 2022

I think it should also work with PWAsForFirefox.

It doesn't. How to debug ?

@filips123
Copy link
Owner

I'm not completely sure, I thought that the fix would work with all programs/extensions that use native messaging out-of-the-box. I think you can run Firefox with MOZ_LOG=NativeMessagingPortal:5 snap run firefox to get all native messaging-related logs and errors.

@michael-markl
Copy link

I get the following messages when I run MOZ_LOG=NativeMessagingPortal:5 snap run firefox and open the pwa extension:

[Parent 32690: Main Thread]: D/NativeMessagingPortal will be used
[Parent 32690: Main Thread]: D/NativeMessagingPortal is available
[Parent 32690: Main Thread]: D/NativeMessagingPortal creating session with handle suffix firefox_firefoxpwa_1802303437
[Parent 32690: Main Thread]: D/NativeMessagingPortal session created with handle /org/freedesktop/portal/desktop/session/1_153/firefox_firefoxpwa_1802303437
[Parent 32690: Main Thread]: D/NativeMessagingPortal starting firefoxpwa, requested by [email protected] in session /org/freedesktop/portal/desktop/session/1_153/firefox_firefoxpwa_1802303437
[Parent 32690: Main Thread]: D/NativeMessagingPortal native application start requested in session /org/freedesktop/portal/desktop/session/1_153/firefox_firefoxpwa_1802303437, pending response for /org/freedesktop/portal/desktop/request/1_153/firefox/86682925
[Parent 32690: Main Thread]: D/NativeMessagingPortal got response signal for /org/freedesktop/portal/desktop/request/1_153/firefox/86682925 in session /org/freedesktop/portal/desktop/session/1_153/firefox_firefoxpwa_1802303437
[Parent 32690: Main Thread]: D/NativeMessagingPortal native application start canceled by user in session /org/freedesktop/portal/desktop/session/1_153/firefox_firefoxpwa_1802303437
[Parent 32690: Main Thread]: D/NativeMessagingPortal session /org/freedesktop/portal/desktop/session/1_153/firefox_firefoxpwa_1802303437 was closed by the portal
[Parent 32690: Main Thread]: D/NativeMessagingPortal cannot close session /org/freedesktop/portal/desktop/session/1_153/firefox_firefoxpwa_1802303437, unknown handle

Does this help with debugging?

@merlijn-sebrechts
Copy link

IT WORKS!

The issue of @michael-markl is that, for some reason, the permission is disabled by default. The full steps to enable it are below:

  1. Stop Firefox

  2. Update to firefox beta

    snap refresh firefox --beta
    
  3. Grant permissions for firefox

    flatpak permission-set webextensions firefoxpwa snap.firefox yes
    

After this, restart firefox and the extension works!

@michael-markl
Copy link

@galgalesh Thanks for the hint! This did in fact work for me as well !

@brennoflavio
Copy link

Native messaging is on firefox snap stable now, so the extension works as expected on default Ubuntu installations without any tweaks.

Maybe update the readme to remove snap and Ubuntu mentions while keeping Flatpaks for now?

https://forum.snapcraft.io/t/call-for-testing-native-messaging-support-in-the-firefox-snap/31055/34

@filips123
Copy link
Owner

Thanks for notifying me, I've updated the readme.

@ItsRogueRen
Copy link

Are there any updates on the flatpak side of things? I've been using this for Discord on my desktop but want to do the same on my Steam Deck (PWA lets me do stuff like Stylus for CSS theming without mods)

@filips123
Copy link
Owner

I think not. The PR to add native messaging portal (flatpak/xdg-desktop-portal#705) still hasn't been merged.

@ItsRogueRen
Copy link

I think not. The PR to add native messaging portal (flatpak/xdg-desktop-portal#705) still hasn't been merged.

It does look active though, so it seems its just a matter of time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants