Takios/download-with-kget

Error at sending native message: Full error message: Error: Attempt to postMessage on disconnected port

Closed this issue · 10 comments

Like the title says, I am getting that error notification whenever I try to download with KGet.
Unlike the other issue, I have already installed the native application.

Specs:

            .-/+oossssoo+/-.               thetimbrick@compuber 
        `:+ssssssssssssssssss+:`           -------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.10 x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: 20J9S0M400 ThinkPad L570 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.19.0-23-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 1 day, 4 hours, 53 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 4326 (dpkg), 6 (flatpak) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.2.2 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1366x768 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: Plasma 5.26.2 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: kwin 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Klassy 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: [Plasma], Breeze [GTK3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Fluent [Plasma], Fluent [GTK2/3] 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: konsole 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: Intel i5-7200U (4) @ 3.100GHz 
    .ossssssssssssssssssdMMMNysssso.       GPU: Intel HD Graphics 620 
      -+sssssssssssssssssyyyssss+-         Memory: 4141MiB / 7840MiB 

Mozilla Firefox 106.0.2 ( Debian Package, not snap)
kget 22.08.2

I'm currently unable to reproduce the issue. You might be missing one of the dependencies for the native application:

  • python3-pydbus
  • python3-json
  • python3-construct

The exact package names might be different on Ubuntu.

I installed everything except Python3-json, that might be the problem as I thought I already had it installed

If I were to run the python script manually would I get an error about a missing package?

You can try the script manually with echo "Insert any URL here" | /usr/lib64/mozilla/native-messaging-hosts/download_with_kget.py. If a package/module is missing, then it should complain about it, yes.

When invoked manually I get the following output:

Traceback (most recent call last):
  File "/usr/lib64/mozilla/native-messaging-hosts/download_with_kget.py", line 42, in <module>
    message = get_message()
  File "/usr/lib64/mozilla/native-messaging-hosts/download_with_kget.py", line 16, in get_message
    return json.loads(message_content)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Ah my mistake, the echo method is expected not to work (it's been a few years since I've had a look at this, I forgot :D )

Anyway I was able to reproduce the issue now and am working on resolving it.

I have some good news and some bad news.

The good news is, that I was able to fix this particular issue with the 086d075 commit.

However, the .deb based Firefox install now fails the native message with an "Unexpected error". I have not been able to find the cause or a workaround for this.

I am inclined to say this is an issue with the .deb, because I've also been unable to get other extensions that rely on native messaging to work, like "KeepassXC-Browser" or "Plasma Integration".

According to https://discourse.ubuntu.com/t/call-for-testing-native-messaging-support-in-the-firefox-snap/29759 the snap-based Firefox on Ubuntu now has Native Messaging support in its beta branch (sudo snap install firefox --beta) and those addons, including download-with-kget, work there.

The issue is indeed resolved for me with this commit, though the issue you are having now I am not having and KGet opens with the download link ready to go. Is the installation failing with the addon?

That's interesting, maybe I made a mistake. I'll reinstall my Ubuntu VM and try again.
You are using the Firefox .deb provided by the mozillateam PPA, right?

That is correct

Welp, it still occurs for me after a reinstall. I'll still close this issue now because the original issue is fixed, the follow-up issue doesn't appear on my main system and you're not affected by the follow-up issue on your system either, so it might be something wrong with my VM setup.