Skip to content

Fatal exception on Electron package for Windows: stack(...).some is not a function #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fretman92 opened this issue Sep 13, 2018 · 5 comments
Assignees
Labels

Comments

@fretman92
Copy link

fretman92 commented Sep 13, 2018

Hello @Skywalker13 , thanks for maintening this package.

I'd like to report an error with the dependency callsite used.
When installed and launched on some computers, Win10 and Win7 as well, hazardous is not working properly and throwing a fatal exception that crashes my electron app.

Here is the stacktrace it logs:

C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\hazardous\lib\index.js:69
      .some ((site) => {
       ^

TypeError: stack(...).some is not a function
    at hazardous (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\hazardous\lib\index.js:69:8)
    at Object.hazarPath.normalize (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\hazardous\lib\index.js:87:10)
    at splitPath (ELECTRON_ASAR.js:58:14)
    at Object.fs.existsSync (ELECTRON_ASAR.js:377:44)
    at Array.<anonymous> (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:81:17)
    at C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:53:24
    at retrieveSourceMapURL (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:120:14)
    at Array.<anonymous> (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:137:26)
    at C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:53:24
    at mapSourcePosition (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:167:21)
    at wrapCallSite (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:338:20)
    at C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:373:26
    at Array.map (native)
    at Function.prepareStackTrace (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:372:24)
    at process.emit (C:\Users\Admin\AppData\Local\Programs\myelectronapp\resources\app.asar\node_modules\source-map-support\source-map-support.js:422:51)
    at process._fatalException (bootstrap_node.js:308:26)

I presume that stack () is returning null or something like that, and I believe it should either be handled, or patched in the original package (I'll try to see with them as well).

Has anybody faced the same problem and uncovered the reason why callsite does not return an array?

@Skywalker13
Copy link
Member

Thanks for the report; I look for this problem the next week.

@Skywalker13 Skywalker13 self-assigned this Sep 16, 2018
@ghost
Copy link

ghost commented Oct 9, 2018

Got same error on Linux with Electron 3.0.3, make app freezing.

@CeQadrat
Copy link

CeQadrat commented Oct 9, 2018

The same problem after upgrading to electron 3.X.X
It seems there have been some changes in the stack of calls from the electron and I caught one interesting bug: I had a unpacked module with the joined paths, and paths after join was packed. But at the same time, if you wrap a join in a function (in the example, the map is used), it makes the paths unpacked.

require('hazardous');
const path = require('path');

const config = {
  scripts: ['some/script/path'],
};

const scriptsUrls = config.scripts.map(script => path.join(__dirname, script));
const scriptsUrls2 = [path.join(__dirname, config.scripts[0])];

console.log(scriptsUrls);    // output: ['.../app.asar.unpacked/.../some/script/path']
console.log(scriptsUrls2);    // output: ['.../app.asar/.../some/script/path']

In the second case, electron.asar is present in the stack, because of this, the modules were considered packed
It began with electron 2.X.X and the same problem was preserved in electron 3.X.X. But now in electron 3.X.X the stack sometimes even comes null

@midevnull
Copy link

I am getting a "Module did not self-register" error on start-up of the packaged app (win10 64bit) with electron 3.1.2.
This error does not happen if remove callsite.

@Skywalker13
Copy link
Member

hazardous is broken since electron > 1. I've still not spend time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants