Logon session error when using credential manager in Windows

Node.js projects which use the keytar library to store credentials with the operating system’s native API work correctly on OS X. However, the same builds fail on the Windows platform with the following error:

Error: A specified logon session does not exist. It may already have been terminated.

Here is a link to the results of building a minimal example on OS X and Windows. The source repository is here. Does anyone know how to resolve this logon session error with Windows builds?

According to https://github.com/zowe/imperative/pull/464 , Windows Credentials Manager seems to have a “transient state” where the newly created account is not yet accessible AFAICS and this error occurs.

Not 100% sure since your build doesn’t show which line the error occurs on, it only shows some unrelated exception handler.

Thanks for your help. I added log statements to my example and the new build results show that the error occurs during the first attempt to access the credential manager using keytar.

Additionally, thank you for linking another project which also received the error. I searched the build logs from that pull request (they use GitHub Actions and not Travis CI) but no results were returned for the “specified logon session” error. It’s possible the comment was referencing an error that occurred only during a local test.

Do you have any additional suggestions?

Hi @jblack-vail
Did you find a workaround for it by chance?