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

Error: Attempt to postMessage on disconnected port #424

Open
rtbs-dev opened this issue Feb 24, 2022 · 7 comments
Open

Error: Attempt to postMessage on disconnected port #424

rtbs-dev opened this issue Feb 24, 2022 · 7 comments

Comments

@rtbs-dev
Copy link

running snap jabrefv5.5:

JabRef 5.5--2022-01-17--27a05c7
Linux 5.13.0-30-generic amd64 
Java 16.0.2 
JavaFX 17.0.1+1

Trying to get the jabfox extension to work, already followed the instructions (for both snap and portable versions, neither have worked).

JabRef: Error connecting to JabRef: Error: Attempt to postMessage on disconnected port connector.js:146:13
    sendBibTexToJabRef moz-extension://2e561525-5048-48cb-b096-ad1abb6f5a44/connector.js:146
    (Async: promise callback)
    sendBibTexToJabRef moz-extension://2e561525-5048-48cb-b096-ad1abb6f5a44/connector.js:145
    callMethodWithCookies moz-extension://2e561525-5048-48cb-b096-ad1abb6f5a44/connector.js:44
    (Async: promise callback)
    callMethodWithCookies moz-extension://2e561525-5048-48cb-b096-ad1abb6f5a44/connector.js:44
    (Async: promise callback)
    callMethodWithCookies moz-extension://2e561525-5048-48cb-b096-ad1abb6f5a44/connector.js:17
    receiveMessage moz-extension://2e561525-5048-48cb-b096-ad1abb6f5a44/external-scripts/messaging.js:85
    init moz-extension://2e561525-5048-48cb-b096-ad1abb6f5a44/external-scripts/messaging.js:179

I even disabled ublock on the zotero site in case that was an issue, but I'm definitely able to generate citations... e.g. i can cite this page and the extension debugger console in firefox shows:

JabRef: Send BibTeX to JabRef:  
@article{barberis_canonico_machine_2018,
	title = {Machine Learning as Grounded Theory: Human-Centered Interfaces for Social Network Research through Artificial Intelligence},
	volume = {62},
	issn = {2169-5067},
	url = {https://doi.org/10.1177/1541931218621287},
	doi = {10.1177/1541931218621287},
	shorttitle = {Machine Learning as Grounded Theory},
	abstract = {Internet technologies have created unprecedented opportunities for people to come together and through their collective effort generate large amounts of data about human behavior. With the increased popularity of grounded theory, many researchers have sought to use ever-increasingly large datasets to analyze and draw patterns about social dynamics. However, the data is simply too big to enable a single human to derive effective models for many complex social phenomena. Computational methods offer a unique opportunity to analyze a wide spectrum of sociological events by leveraging the power of artificial intelligence. Within the human factors community, machine learning has emerged as the dominant {AI}-approach to deal with big data. However, along with its many benefits, machine learning has introduced a unique challenge: interpretability. The models of macro-social behavior generated by {AI} are so complex that rarely can they translated into human understanding. We propose a new method to conduct grounded theory research by leveraging the power of machine learning to analyze complex social phenomena through social network analysis while retaining interpretability as a core feature.},
	pages = {1252--1256},
	number = {1},
	journaltitle = {Proceedings of the Human Factors and Ergonomics Society Annual Meeting},
	shortjournal = {Proceedings of the Human Factors and Ergonomics Society Annual Meeting},
	publisher = {{SAGE} Publications Inc},
	author = {Barberis Canonico, Lorenzo and {McNeese}, Nathan J. and Duncan, Chris},
	urldate = {2022-02-24},
	date = {2018-09-01},
	langid = {english},
	file = {SAGE PDF Full Text:https\://journals.sagepub.com/doi/pdf/10.1177/1541931218621287:application/pdf}
}

Followed by the same error.

@LyzardKing
Copy link
Collaborator

I tried on my machine and it works, so it should be only a connection issue.
Could I ask which linux distro, browser, and install method of jabref you're using?
Unfortunately, the snap/flatpak browsers do not yet work with the native messaging protocol, used by this extension.

@rtbs-dev
Copy link
Author

rtbs-dev commented Feb 28, 2022

@LyzardKing

Ubuntu 21.10 (64-bit)
Gnome 40.4.0 (Wayland)
Firefox Snap for Ubuntu 97.0.1 (64-bit)

So I suppose the snap browser is the issue then? I can try to reinstall w/ a .deb, and report back.

(On another note, I guess this issue means the main jabref app won't be distributed as .appimage anytime soon? 😅 )

EDIT: seems like this may be an issue for you guys going forward: 😐 Not a fan of snaps for this reason, tbh, though I was excited for containerization originally. Some googling led me here and to the github PR, which I guess y'all probably know about, but thought I'd link it to this issue in case others find this looking for help.

@tobiasdiez
Copy link
Member

Is there a possibility to recognize the snap version of Firefox? Then I could show a specific explanation in this case. @tbsexton could you run the example from https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/getBrowserInfo in your web console. Thanks!

@rtbs-dev
Copy link
Author

@tobiasdiez Running that example in the console seems to only give me a Promise object with no information.

I already went ahead and uninstalled (snap remove firefox) and installed the deb version (nightly, using the ubuntu ppa and firefox-trunk since the normal apt install firefox now defaults to snap 🤦‍♀️)

Still not working, both with the snap and portable versions of the jabref app.

On another note, I see a manifest warning for the jabref extension in firefox settings:

Warning details

Reading manifest: Warning processing key: An unexpected property was found in the WebExtension manifest.

Hitting "inspect" takes me to a console for this extension, and trying to use the extension while monitoring this console gives me this error, right after seeing a successful zotero bibtex (JabRef: Send BibTex to JabRef:

JabRef: Error connecting to JabRef: Error: Attempt to postMessage on disconnected port connector.js:146:13
    sendBibTexToJabRef moz-extension://53c64e8a-4761-4c48-9812-71f0ba692ed4/connector.js:146
    (Async: promise callback)
    sendBibTexToJabRef moz-extension://53c64e8a-4761-4c48-9812-71f0ba692ed4/connector.js:145
    callMethodWithCookies moz-extension://53c64e8a-4761-4c48-9812-71f0ba692ed4/connector.js:44
    (Async: promise callback)
    callMethodWithCookies moz-extension://53c64e8a-4761-4c48-9812-71f0ba692ed4/connector.js:44
    (Async: promise callback)
    callMethodWithCookies moz-extension://53c64e8a-4761-4c48-9812-71f0ba692ed4/connector.js:17
    receiveMessage moz-extension://53c64e8a-4761-4c48-9812-71f0ba692ed4/external-scripts/messaging.js:85
    init moz-extension://53c64e8a-4761-4c48-9812-71f0ba692ed4/external-scripts/messaging.js:179

Which I guess is the same thing as before.

@rtbs-dev
Copy link
Author

Well, after all that, I installed the .deb and it works fine now. Looks like the "currently working combo" for linux+jabref+jabfox+firefox is:

  • only install the jabref .deb (snap/portable can't be found by the extension)
  • do not use snap firefox (which is the default via apt on ubuntu since september 2021)
  • for those reading this, i'm using firefox-trunk via this ppa to get a working .deb of firefox.
  • get the right json into ~/.mozilla/native-messaging-hosts/org.jabref.jabref.json
  • don't have any running versions of jabref except the .deb one (had this issue since i was comparing portable vs. snap vs. deb and the first one opened blocks port 6050, see Options>preferences>network

@LyzardKing
Copy link
Collaborator

The jabref snap has to be enabled to use the extension (via the snap connect command from the jabref wiki)
The browser snap/flatpak packages do not work.
The issue might have been that the .json file was set to use the snap version.

@LyzardKing
Copy link
Collaborator

I have a version of the firefox flatpak working with the jabref flatpak.
The only problem (and it's a big one) is that you have to poke a big hole in the sandbox, by giving firefox the permission to run commands in the host system.
There is work ongoing for an official flatpak/snap portal to enable NativeMessaging: https://phabricator.services.mozilla.com/D140803

I'm not sure if I should upload the working (but sandbox breaking) flatpak additions. If we do there should be a big red notice.
The alternative is we wait a bit more to see if the new portal arrives soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants