CLI commands are very slow

rensa
rensa
Community Member

I love the 1P CLI! But I'm struggling with how long it takes for its commands to return. Commands like op signin and $(opget item [...] --fields password) (to inject a password into a larger command) take 10-15 seconds to run. I've recently moved from a previous laptop to a new one (both using WSL2 with Ubuntu 20.04 inside Windows 10) and am having the same problem.


1Password Version: 1.9.2 (CLI) / 7.7.810 (Windows)
Extension Version: Not Provided
OS Version: Ubuntu 20.04 / Windows 10 20H2
Sync Type: 1Password Cloud

Comments

  • ag_yaron
    ag_yaron
    1Password Alumni
    edited July 2021

    Hey @rensa ,

    I'm not sure why is the signin command taking so long, but for other commands you can try and use the --cache flag to store the data on your RAM temporarily which might improve performance instead of reaching out to our servers for every command. https://support.1password.com/command-line-reference/#cache-item-and-vault-information

    In addition, I'd suggest trying to ping our servers or traceroute to them in order to figure out why it is taking so long to get a response from them.
    signin should be quite fast, and other commands should not take more than 3-5 seconds (if you only fetch one item, but if you are fetching entire vaults that might take 10-15 seconds or more).

  • rensa
    rensa
    Community Member
    edited July 2021

    Thanks @ag_yaron! I'll give that a go. Which servers specifically should I be tracerouting?

    These delays happen even when I'm just pulling a single password from the vault.

  • ag_yaron
    ag_yaron
    1Password Alumni

    I'd start by whitelisting 1password.com and see if that has any effect.

  • rensa
    rensa
    Community Member
    edited July 2021

    I was able to run traceroute 1password.com, and that resolved in milliseconds, but tracepath 1password.com starts going "no reply" and sitting around for 10-20 seconds before going "too many hops" after it gets away from local networks. I'm a little out of my depth here, though, to be honest!

  • ag_yaron
    ag_yaron
    1Password Alumni
    edited July 2021

    Thanks for the update, @rensa .

    To make sure we're on the same page, when you said:

    These delays happen even when I'm just pulling a single password from the vault.

    Which command are you running? For example, are you using op get item Amazon , or are you using op get item UuidOfItem --vault UuidOfVault ?
    The reason I'm asking is that the first example is very non-specific and will need to go over all of your vaults and items to find a possible match, which might take a long while if you have a lot of vaults and/or a lot of items in each vault. The 2nd example is very specific and should reduce fetching times drastically.

    I just want to make sure that the issue at hand is indeed a network related one and not a simple case of the CLI having to iterate through a lot of vaults and/or items to find a relevant result (which is normal behavior for the first example).

  • rensa
    rensa
    Community Member
    edited July 2021

    @ag_yaron No worries! I was originally doing op get item [item name] --fields password, but I've now tested adding --vault [vault uuid] and it doesn't seem to make a difference. About 5 seconds to retrieve a single password from a specified vault (just running op get item directly), or 15-20 seconds to retrieve two of them and inject them into a docker build command with:

    docker build --build-arg $(op get item [item 1] --fields password) --build-arg $(op get item [item 2] --fields password) myimage .
    

    (The build command takes about 1-2 seconds to start without any --build-arg flags that evaluate op get item.)

  • ag_yaron
    ag_yaron
    1Password Alumni

    Thanks for the additional info, @rensa .

    If you start your workflow with op list items --cache , and then add the --cache flag to any additional command you send, is there a noticeable difference in the time it takes?

    For example:

    1. op list items --cache
    2. op get item [item 1] --fields password --cache
This discussion has been closed.