lastpass / lastpass-cli

LastPass command line interface tool
GNU General Public License v2.0
2.85k stars 291 forks source link

Handle failed http requests better #634

Open wfaulk opened 1 year ago

wfaulk commented 1 year ago

Any failed http request results in the program exiting:

https://github.com/lastpass/lastpass-cli/blob/8767b5e53192ad4e72d1352db4aa9218e928cbe1/http.c#L344-L345

If it's just getting the blob, it could still function with the local cache. It should either continue with the local cache, probably with a warning, or at least indicate that the local cache can be specified with --sync=no.

wfaulk commented 1 year ago

There seemed to have been a temporary outage of the lastpass.com web site that caused the CLI to produce the error:

Error: HTTP response code said error.

and exit without using the cached blob until I found the --sync=no option.

artm commented 1 year ago

Had encountered the same problem today, except lpass is integrated across multiple scripts and CLI tools in my workflow. My workaround is to set longer autosync time with export LPASS_AUTO_SYNC_TIME=$(( 24 * 60 * 60 )) in the shell where I run my tools from. As long as only read access to preexisting secrets is needed this fixes the infantile error message ("Computer said no" or something to that extent).