mrjones2014/op.nvim

Cannot connect to desktop app

natepelzel opened this issue · 23 comments

Whenever I try to run :OpSignin, or any other :Op* command, I get the following error:

[ERROR] 2023/02/08 17:44:40 connecting to desktop app: read: connection reset, make sure the CLI is correctly installed 
and Connect with 1Password CLI is enabled in the 1Password app   

Things I've tried so far:

  • Double and triple checked requirements and installation instructions for op.nvim and onepassword-cli.
  • Tested the op command works fine outside of nvim. It works fine.
  • Tested with biometric lock enabled, as well as token-based sessions.
  • Uninstall and reinstall op cli
  • Specifying op_cli_path in config

So far, nothing has helped. I am on Arch Linux running neovim v0.8.3. Not sure if it matters, but I am in a wayland desktop environment.

Thanks in advance!

This is an issue with the 1Password CLI/desktop app connection, not the Neovim plugin. Take a look at this and if you don’t have luck, feel free to reach out to 1Password’s excellent support team: https://developer.1password.com/docs/cli/get-started

I am seeing the same error, though it may be specific to Neovim+1Password CLI rather than this plugin.
I see the error when I try to run op from a neovim terminal, for example :!op signin or :term op signin. However, I do not get an error if I use the :term command to spawn a terminal and run op signin from there, or if I try those same commands from Vim.
It also happens only on Linux, not macOS.

Are you running a flatpak/AppImage of Neovim? Maybe it has to do with sandboxing?

I'm using bob-nvim to install Neovim nightly, currently on v0.9.0-dev-1319+g10baf8971.

I also have a version installed with the .deb package into /usr/bin/nvim, v0.9.0-dev-987+g371a74e4e, and that actually behaves differently: :!op signin and :term op signin work, but :OpSignin gives the same "connection reset" error.

Can you try to provide a minimal init.lua to reproduce the issue? I have not been able to reproduce.

Sure, I'll do that when I get the chance.
Since I didn't provide it before, my OS info is Ubuntu 22.04.

Also curious, what happens if you re-run the post-install hook? You can either uninstall and reinstall the plugin, or just cd to the plugin directory and run make install.

I'm wondering if it has something to do with the remote proxy process to the CLI.

I think I tried reinstalling the plugin, but I'll try that again as well.

Re-running the post-install hook didn't help. I tried making a minimal init.lua but sandboxing nvim while making 1password-cli work is hard.

Ok, I got the minimal init.lua working with the NVIM_APPNAME environment variable:

init.lua:

require('packer').startup(function(use)
    use 'wbthomason/packer.nvim'
    use({ 'mrjones2014/op.nvim', run = 'make install' })
end)

When running NVIM_APPNAME=nvim-test /usr/bin/nvim, :!op signin works without errors, but :OpSignin gives the connection reset error. :!op item get "Test" also works as expected.
When running NVIM_APPNAME=nvim-test nvim, (bob-nvim nightly installed in user home), both :!op signin and :OpSignin give the connection reset error.

Just to double check, your 1Password CLI is installed to /usr/local/bin/op correct? It must be installed here for the desktop app to be able to check its signature correctly.

It's installed in /usr/bin/op by the 1password .deb package, but works in the terminal and /usr/bin/nvim's shell so it seems like the desktop app can check the signature correctly.

I think I know the answer but just to make sure, you're using CLI v2, correct? What version of the CLI are you using?

Also you're not on aarch64-linux right? Currently there is only an x86_64-linux build of the backend process in the repo, but if needed I can add an aarch64-linux.

Yes, I'm using the op v2 CLI on x86_64.

Just to update interested parties, I have not forgotten about this issue. I've been investigating the root cause.

I believe we've identified the issue, and it will hopefully be fixed by the next 1Password CLI version

Could yall check if this is still an issue with the latest version of 1Password CLI? I can't reproduce.

I'm seeing the issue with versions 2.18.0 and 2.19.0-beta.01.

Hmm, and you're using the latest 1Password desktop app version as well?

Using the beta version 8.10.8

edit: actually it's 81008013, which is not the latest - let me try updating

Update: it worked!

I upgraded from 1Password for Linux 8.10.8 (81008013) to (81008042) and can now use op.nvim from nvim, and :!op signin works as well!

Awesome! Anyone else let me know if updating doesn’t work for you.