Skip to content
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

Using nwjc with my webpack bundle results in FATAL error #7348

Closed
tonetechnician opened this issue Jan 30, 2020 · 2 comments
Closed

Using nwjc with my webpack bundle results in FATAL error #7348

tonetechnician opened this issue Jan 30, 2020 · 2 comments

Comments

@tonetechnician
Copy link

tonetechnician commented Jan 30, 2020

NWJS Version : 0.43.6
Operating System : Windows 10

Expected behavior

I expect that nwjc should encrypt my webpack bundle.js correctly and allow it to be loaded from the Window.

Actual behavior

When running nwjs with <script type="text/javascript"> require('nw.gui').Window.get().evalNWBin(null, './webpackBuild/bundle.bin'); </script> tags, the Window breaks leaving me with this:

image

I'm given the following errors in a chrome_debug.txt:

[20308:20660:0130/134837.061:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[20308:20660:0130/134837.061:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[20308:20660:0130/134837.063:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[20308:20660:0130/134837.072:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[20308:20660:0130/134837.077:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[20308:20660:0130/134837.107:WARNING:push_messaging_service_factory.cc(37)] PushMessagingService could not be built because InstanceID is unexpectedly disabled
[20308:20660:0130/134837.116:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[20308:20660:0130/134837.122:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[20308:20660:0130/134837.384:WARNING:account_consistency_mode_manager.cc(286)] Desktop Identity Consistency cannot be enabled as no OAuth client ID and client secret have been configured.
[17796:16648:0130/134837.826:FATAL:nw_custom_bindings.cc(306)] Check failed: !cache->rejected. 
Backtrace:
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEFAA272+11045730]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEFA9832+11043106]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEFBC383+11119731]
	IsSandboxedProcess [0x00007FFEFF9E0537+5174143]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFED44A0A+8532730]
	v8::internal::Accessors::MakeAccessor [0x00007FFEFD9502CD+18461]
	v8::internal::Accessors::MakeAccessor [0x00007FFEFD94F75A+15530]
	v8::internal::Accessors::MakeAccessor [0x00007FFEFD94ED6F+12991]
	v8::internal::Accessors::MakeAccessor [0x00007FFEFD94E9B7+12039]
	v8::internal::NativesCollection<0>::GetScriptsSource [0x00007FFEFE26C9DD+519229]
	v8::internal::NativesCollection<0>::GetScriptsSource [0x00007FFEFE1F81DB+42043]
	v8::internal::NativesCollection<0>::GetScriptsSource [0x00007FFEFE1F81DB+42043]
	v8::internal::NativesCollection<0>::GetScriptsSource [0x00007FFEFE1F81DB+42043]
	v8::internal::NativesCollection<0>::GetScriptsSource [0x00007FFEFE1F5D3E+32670]
	v8::internal::NativesCollection<0>::GetScriptsSource [0x00007FFEFE1F592C+31628]
	v8::internal::Execution::Call [0x00007FFEFDA0EC72+1058]
	v8::internal::Execution::Call [0x00007FFEFDA0E943+243]
	v8::Script::Run [0x00007FFEFD8D9193+611]
	IsSandboxedProcess [0x00007FFEFF764810+2569816]
	GetHandleVerifier [0x00007FFF0031813C+8507916]
	GetHandleVerifier [0x00007FFF00318C37+8510727]
	GetHandleVerifier [0x00007FFF00318E3C+8511244]
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF00E7E55A+7272882]
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF0197AB6A+18792386]
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF0197A9CA+18791970]
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF00FFA4D2+8829226]
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF0106CC8B+9298147]
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF0106CB8B+9297891]
	GetHandleVerifier [0x00007FFF003080F8+8442312]
	GetHandleVerifier [0x00007FFF00308CF7+8445383]
	GetHandleVerifier [0x00007FFF00307FFC+8442060]
	v8::internal::NativesCollection<0>::GetScriptsSource [0x00007FFEFE40BFD2+2220594]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEFF76E1+11362257]
	IsSandboxedProcess [0x00007FFEFFAF15E9+6292529]
	IsSandboxedProcess [0x00007FFEFFAF19FA+6293570]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEFC1FF2+11143394]
	IsSandboxedProcess [0x00007FFEFFAF1D96+6294494]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEFE092E+11268638]
	IsSandboxedProcess [0x00007FFEFF9BF7F3+5039675]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEF24251+10496833]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEF516BE+10682286]
	v8::internal::TorqueGeneratedExportedMacrosAssembler::StoreSortStateNumberOfUndefined [0x00007FFEFEF23846+10494262]
	ChromeMain [0x00007FFEFC5B11BD+293]
	Ordinal0 [0x00007FF765F1271A+10010]
	Ordinal0 [0x00007FF765F11755+5973]
	GetHandleVerifier [0x00007FF76602E812+747826]
	BaseThreadInitThunk [0x00007FFF7EED7BD4+20]
	RtlUserThreadStart [0x00007FFF7FC4CED1+33]
Task trace:
Backtrace:
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF0106A91C+9289076]
	RelaunchChromeBrowserWithNewCommandLineIfNeeded [0x00007FFF0106A91C+9289076]
	GetHandleVerifier [0x00007FFF0030AD18+8453608]
	GetHandleVerifier [0x00007FFEFFCC1ACD+1862557]
IPC message handler context: 0x28D494B6

How to reproduce

I've used webpack with the following configuration:

const path = require('path');
const webpack = require('webpack');
const EncodingPlugin = require('webpack-encoding-plugin');

module.exports = {
  target: 'node-webkit',
  // debug: true,
  optimization: {
    usedExports: true
  },
  // devtool: "source-map",
  entry: './entry.js',
  output: {
    path: path.resolve(__dirname, 'webpackBuild'),
    filename: 'bundle.js'
  },
  resolve: {
    modules: ['node_modules'],
    extensions: ['.js']
  },
  externals: {
    bindings: 'require("bindings")'
  },
  module: {
    rules: [
      {
        test: /\.node/,
        use: 'node-loader'
      },
      {
        test: /\.exe/,
        use: 'raw-loader'
      }

    ]
  },
  plugins: [
    // Ignore uws module that socket.io depends on. Doesn't seem necessary to have this at this point.
    new webpack.IgnorePlugin(/uws/),
    // new webpack.LoaderOptionsPlugin({
    //   debug: true
    // }),
    // Necessary to ensure that bundle is understood by nwjs
    new EncodingPlugin({                          
      encoding: 'iso-8859-1'
  })
  ],
}

I've used node-gyp native addons such as cap and midi.

@tonetechnician
Copy link
Author

tonetechnician commented Feb 3, 2020

So further updates, this looks as if it's something to do with the new NW.

Testing the same procedure on nw v0.42.0, I have no issues. Able to bundle and encrypt and use the .bin with no issue

@tonetechnician
Copy link
Author

I have a feeling this was to do with the .bin not being able to find my .node. Unfortunately node-loader doesn't create a copy in the source directory for use by the bundle. After using this loader everything seems to be working better.

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

No branches or pull requests

1 participant