Simultaneous API calls fails

mickael
mickael
Community Member

Hi,

Another question again regarding the op CLI ;)

I use it in a scaffolding tool to generate all my credentials and ssh keys needed for a new server provisioning. The tool is written in NodeJS (Yeoman).

I discovered that when the requests were done in an asynchronous process (so simultaneously), the authentication fails.

Currently, 5 server password scripts were called. Each script does an authentication check then send the request.

I changed how the promises were resolved to handle them in a synchronous way. Things are working when the requests are emitted one after one.


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • Hrmm....

    This is likely due to how op handles creating unique identifiers for requests. The server requires that each request it receives has a unique (to the session) identifier. For our normal apps this is trivial as it's just a counter. For a short-lived process like the CLI tool, this is more challenging. On the CLI we base that identifier on amount of time since session creation. And so if two commands were run at the exact (or close enough) same time, then it's possible for them to pick the same identifier which results in the server rejecting the duplicates.

    We've been working on things to make this less likely, but our current recommendation is to not do concurrent requests with the CLI.

    Rick

  • mickael
    mickael
    Community Member

    @rickfillion Thanks for the explanation, I understand.

  • cohix
    cohix
    1Password Alumni

    Let us know if you have any other questions!

This discussion has been closed.