I have been having this problem for quite some time now but couldn't figure it out... Nothing I try really works at all. From conversions of the ssl files into many different formats and checking folder permissions nothing worked (or, to be more explicit, it all is as it should be to work). Does anyone know what could be off? Thank you very much for your help, I'm getting to the desperate side at this point...
Could this be version related? How could I check if that's the case?
Here is my code:
var ssl_options = {
pfx : fs.readFileSync(my_pfx_path),
passphrase: 'password'
};
//OR
var ssl_options = {
key : fs.readFileSync(my_key_path),
cert : fs.readFileSync(my_cert_path)
};
var protocol = "https";
preparedApp = require(protocol).createServer(ssl_options,app);
var io = require('socket.io')(preparedApp);
preparedApp.listen(8080, function(){});
io.on('connection', function(socket){});
And here is the log of my ssl_options...
{ key: <Buffer 41 ...>,
cert: <Buffer 4a ...> }
This errors with the error in the title throw new Error('Missing PFX or certificate + private key.');
.
Full trace log:
Error: Missing PFX or certificate + private key.
at Server (tls.js:1127:11)
at new Server (https.js:35:14)
at Object.Server (https.js:29:41)
at Object.<anonymous> (/nginx/script.js:477:34)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
Could someone give me a helping hand? tyvm...
I'm using socket.io version 1.3.7 The cert is working with regular https in the browser / non-socket.io. The files are correct so I really don't know why this should be happening
I had a broken if clause in my code that returned protocol to "http" and caused an error when trying to fetch the ssl info...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With