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

Cannot require 'https' module in Web Worker #5918

Closed
binamtech opened this issue May 18, 2017 · 6 comments
Closed

Cannot require 'https' module in Web Worker #5918

binamtech opened this issue May 18, 2017 · 6 comments

Comments

@binamtech
Copy link

Trying to use 'https' module in Web Worker causes error:
...
message: "Uncaught Error: No such module: js_stream",
filename: "_stream_wrap.js"
...

const https = require('https');

Environment:

  • NW.js: v0.22.3 sdk;
  • platform: Mac OSX (x64) Sierra.
@kailniris
Copy link

Did you enable node worker command line option?
http://docs.nwjs.io/en/latest/References/Command%20Line%20Options/#-enable-node-worker

@binamtech
Copy link
Author

Yes. Here is my "command line option":
"chromium-args": "--enable-gcm --enable-node-worker"

@Christywl
Copy link
Contributor

I can reproduce this issue on Linux/Windows with nwjs-sdk-v0.22.3.
image
package.json:

{
  "name": "test",
  "main": "index.html",
  "chromium-args": "--enable-gcm --enable-node-worker"
}

index.html:

<script>
var worker = new Worker('task.js');
console.log(worker);
</script>

task.js(using the example in https://nodejs.org/api/https.html):

const https = require('https');
const fs = require('fs');

const options = {
  pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
  passphrase: 'sample'
};

https.createServer(options, (req, res) => {
  res.writeHead(200);
  res.end('hello world\n');
}).listen(8000);

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rogerwang
Copy link
Member

@binamtech
Copy link
Author

Great! It works.
Thank you for the hotfix.

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

No branches or pull requests

4 participants