Closed Z-Qi closed 5 years ago
Just tested this Windows 10 and received the same error. Logged in just like normal, then attempted to sign out and the error popped up. Like @lukethompsxn after dismissing the error, it worked fine.
Have tried multiple different approaches, but have yet been unable to find a nice solution to this problem. With help from @AbhinavBehal, we think the issue comes from the generated credentials.js file not having the function as it gets built/rebuilt after index.js. This causes the initial reference of credentials to have clearCredentials() be undefined.
After looking into it further, it seems the issue comes from when the build is run. When index.js is executed, it tries to find '.../misc/credentials'
, node looks first for credentials.js
. For clean installs this means that it will error out with 'module not found' as the file hasn't been generated yet; but with existing builds it will find the old generated credentials.js
. This means that the imported reference does not include the new clearCredentials() function (or its export).
The reason it works in subsequent attempts is that after the first error is thrown, the application is rebuilt causing index.js to reimport '.../misc/credentials'
which now uses the newly (and correct) generated credentials.js
.
The non-code fix for this is to either run npm run createjs
to generate the new JS files then npm start
as usual. Or to just get the error once and it will work afterwards. The alternative solution would be to modify the start script to generate files before launching the application.
I could implement a 'dirty' fix by importing keytar in index.js
but this feels inappropriate.
@lukethompsxn @joel-clarke @AbhinavBehal how do you want to handle this issue?
@lukethompsxn, I've added the keytar fix for now until a start script fix is implemented so that other devs wont need to do any extra 'fixes' on their end.
Related Issue/Keyword:
Closes #269
Description:
Now that we have auto sign-in, the load credentials button has become redundant. To reflect this change, as discussed in #269, credentials are also cleared on signing out.
Testing:
Steps for manual testing:
Checklist:
npm run lint
)