Azure Error: SSL Error: CERT_UNTRUSTED when using mongoose

Viewed 261

Have a locally running node.js app using mongoose to do crud with mlab's mongodb. No problems

I post my code to github, and then tell Azure to host my app as a webapp, which I have done many times without mongoose.

As best I can tell, Azure does an npm install on my package.json file on my behalf as it installs my app into one of their web server hosts.

If I comment out these lines in my users.js route:

//var mongoose = require('mongoose');
//var ObjectID = require('mongodb').ObjectID;

all is well, Azure runs my app.

If I do not comment them out, I get this error written in the Azure log:

npm http GET https://registry.npmjs.org/mongoose
npm ERR! Error: SSL Error: CERT_UNTRUSTED

In an effort to fix this in my package.json file, I have: [1] forced azure to use this version of node

"engines": {
    "node": "0.8.x"
  },

[2] tried to force to a current version

 "mongoose": "^5.3.11",

[3] tried to force negotiator to this version as GitHub was complaining about a security issue with negotiator

"negotiator": ">=0.6.1",

I would REALLY like to continue to have Azure run my web apps using GitHub, and not get into the Azure command line stuff to install my bits, so I don't have much control of the installation. There is something about Mongoose that is bad.

thanks

2 Answers

One thing you could try is updating to the newer certificates' definitions. This version of config-defs.js might do the trick (usually located under /deps/npm/lib/utils).

You might also need to update that file with an additional certificate as described here

Hope it helps!

Neil Lunn fixed it, thanks. I was having problems running v10.x.x of node, and tried dropping back to V8.x.x to get around a breaking change in v10, and I screwed up the name of V8. "node": "0.8.x" does not get V8, 8.10.0 does and all is well.

Related