bitwarden / desktop

The desktop vault (Windows, macOS, & Linux).
https://bitwarden.com
GNU General Public License v3.0
3.54k stars 401 forks source link

Desktop v1.20 crashes with JavaScript error on Windows after update #495

Closed pnepus closed 4 years ago

pnepus commented 4 years ago

Exception / Crash

Error: The specified module could not be found.
\?\C:\Users\Frodo\AppData\Local\Temp\4a2f6f06-7c8b-4661-8fcf-43ab2cd758f6.tmp.node
   at process.func (electron/js2c/asar.js:138:31)
   at process.func [as dlopen] (electron/js2c/asar.js:138:31)
   at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
   at Object.func (electron/js2c/asar.js:138:31)
   at Object.func [as .node] (electron/js2c/asar.js:147:18)
   at Module.load (internal/modules/cjs/loader.js:645:32)
   at Function.Module._load (internal/modules/cjs/loader.js:560:12)
   at Module.require (internal/modules/cjs/loader.js:685:19)
   at require (internal/modules/cjs/helpers.js:16:16)
   at Object. (C:\Program Files\Bitwarden\resources\app.asar\node_modules@nodert-win10-rs4\windows.security.credentials.ui\lib\main.js:25:20)

Environment

Screenshots or Videos

Crash Error image

Workaround

  1. Go to https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads and download the appropriate version (for your machine architecture) of the Visual C++ redistributable package for Visual Studio 2015, 2017 and 2019 latest update (listed here for convienience):
  2. Install/run that package.
  3. Reboot
  4. Run Bitwarden, it should be working.

Root Cause Analysis

There appears to be downstream dependencies of NodeRT, specifically the @nodert-win10-rs4\windows.security.credentials.ui module, which rely on assemblies/DLLs from the VC++ Build Tools for Visual Studio 2015-2019. These dependencies are generally on a fair amount of Windows computers, including most Windows 10 installs, however this is not consistent and the module is not pulling in those necessary assemblies in its dependency chain during the electron-builder build phase or packaging phase for distribution.

nobuo3 commented 4 years ago

Here's a potential fix @cscharf recently built. Could any of you try this and see if it works? https://cdn.bitwarden.com/misc/Bitwarden-Portable-1.20.0.exe.zip

I can confirm that this works on my Windows10 home build 2004.

glimmerwell commented 4 years ago

Yes, your portable worked for me as well. I did not try to install "Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019". I guess this is good news. Win 7 Pro SP1 desktop 64-bit. And no obvious Windows Hello references in this version of BW, though it might only be a Win 10 thing.

cscharf commented 4 years ago

Great, thanks for testing that everyone. The goal of that fix was to lazy-load the dependencies/module inside of a try {} catch {} so that if it fails, we can quietly and gently disable biometrics on Windows given that the APIs necessary are not installed or there is a dependency error.

The goal (likely in a later release) would then be to add a message on the Settings screen where you would normally enable Windows Hello to state that there are missing dependencies or it is not supported on your version of Windows. I thought Hello was available on Windows 7 using a PIN, but I may be wrong (it's been a very, very long time since I've used Windows). Either way, if you do install the VC++ redistributable for VS 2015, 2017 and 2019 (combined) (latest), then reboot, you should then be able to run Bitwarden and see the Hello settings (maybe, still not sure on this one).

I will be testing as well as our team early Monday to cut an official release/update, just need to be sure this fix doesn't introduce any regression issues and that the intended functionality (Biometrics) still works being lazy-loaded in this fashion.

duggytuxy commented 4 years ago

Same thing from me. First, install the 1.19 version and proceed to upgrade ==>1.20 for it to work ;-)

gate1975mlm commented 4 years ago

https://cdn.bitwarden.com/misc/Bitwarden-Portable-1.20.0.exe.zip

I can also confirm that this new portable build works for me as well on Windows 10 20H2 10 19042.423

And I do have the VC++ redistributable for VS 2015 installed but not 2017 and 2019.

cscharf commented 4 years ago

Just went through a round of testing as well:

👍 New portable prevents crashing when certain Windows APIs, DLLs or other dependencies cannot be found 👍 Windows Hello still works when necessary upstream dependencies are installed (Windows 10), namely the VC++ Redistributable (or Developer Toolkit) 2015-2019

Will convert the draft PR for final approval so we can get this update shipped early this coming week.