"Use as global default on my system" never works -- only ever from home dir
On macOS, no matter where I run "op plugin init aws" from, no matter how often I pick "Use as global default on my system", subsequent invocations of aws only work from my homedir (and subdirs from there). From the root dir, or from any other dir outside of home, it just hangs.
Searched all over and see no mention of this. Searched around in the on-disk config and can't see where this is even specified. Don't see any logging to enable to debug why it's hanging outside of my homedir.
I was able to get this to work once. Same steps as before: new shell, op plugin init aws, select the key, select global. Worked once. Tried to repro it a dozen times and it didn't work. Makes me think there's some sort of race condition?
Would love to get this sorted, it's a real PITA to have to keep switching back to my homedir to get anything done.
op version 2.24.0
1Password Version: 8.10.24
Extension Version: 2.20.0
OS Version: macOS
Browser: Brave
Comments
-
Hey I'm also running into the same problem,
Specifically with the GitHub CLI (gh), I have to reauth each time instead of using a global default.
I have the same error that @jpr5 is currently experiencing just with gh
0 -
I have the same thing, and not only does it hang but the op CLI is running high CPU in the background when it hangs.
If I do an
op plugin init aws
in the directory I'm working in, then I am able to select > Use automatically when in this directory or subdirectories and the AWS CLI works fine then.It's just when it's set as a global default, it hangs.
0 -
To clarify, selecting
Use automatically when in this directory or subdirectories
from the root dir also does not work.0 -
There are several issues related to this matter:
- https://github.com/1Password/shell-plugins/issues/416
- https://github.com/1Password/shell-plugins/issues/407
- https://github.com/1Password/shell-plugins/issues/429
The 1Password team has not responded to these issues, which is frustrating. This issue is particularly annoying because I sometimes clone files to
/tmp
, where the.op
configuration directory created by “Use automatically when in this directory or subdirectories” inop plugin init gh
cannot be persisted.After profiling the
op
CLI, I found thatsearchDefaultsFilelnCurrentDirRecursively
attempts to traverse the parent directories and open files to locate the.op/plugins/<plugin>.json
file before falling back to the global configuration. However, this process can be slow due to the complexity of the parent directory structure.As the description of this function, "Use automatically when in this directory or subdirectories," clearly indicates, there is no need to traverse the entire directory tree of the parent, I propose simplifying the
searchDefaultsFilelnCurrentDirRecursively
function, which would takeO(n)
time, wheren
is the depth of the current directory relative to the root. I do not know the signature of the original function, so this function may need to be rewritten to match the exact behavior. Unit tests should be added to this code, but I have tested it with some hanging cases in my directory. I hope this helps!package main import ( "errors" "os" "path/filepath" "strings" ) func searchDefaultsFilelnCurrentDirRecursively(dir string, program string) ([]byte, error) { dirToCheck := filepath.Clean(dir) configFile := filepath.Join(".op", "plugins", program+".json") for len(dirToCheck) > 0 { configFilePath := filepath.Join(dirToCheck, configFile) content, err := os.ReadFile(configFilePath) if err == nil { return content, nil } dirToCheck = dirToCheck[:strings.LastIndexByte(dirToCheck, byte(os.PathSeparator))] } content, err := os.ReadFile(filepath.Join("/", configFile)) if err == nil { return content, nil } return nil, errors.New("no defaults found") }
0