0
votes

I have been using Parse Server locally without any issues until I enabled SSL. Now I have a number of unauthorized and other errors that prevent me connecting to the remote DB.

The database is hosted with NodeChef and they provide a sslCAFile which I have tried to add to my Parse Server config as advised here. However, I am still unable to connect and am getting the following errors in terminal.

warn: Unabled to ensure uniqueness for user email addresses: Error: unable to get issuer certificate at Error (native) at TLSSocket. (_tls_wrap.js:1000:38) at emitNone (events.js:67:13) at TLSSocket.emit (events.js:166:7) at TLSSocket._finishInit (_tls_wrap.js:567:8) error: Uncaught internal server error. { [MongoError: unable to get issuer certificate] name: 'MongoError', message: 'unable to get issuer certificate' } Error: unable to get issuer certificate at Error (native) at TLSSocket. (_tls_wrap.js:1000:38) at emitNone (events.js:67:13) at TLSSocket.emit (events.js:166:7) at TLSSocket._finishInit (_tls_wrap.js:567:8)

My Parse Server config looks like this:

var api = new ParseServer({
    databaseURI: databaseUri || '',
    databaseOptions: {
        mongos: {
            ssl: true,
            sslValidate: true,
            allowConnectionsWithoutCertificates: true,
            sslCA: [fs.readFileSync('SSLCA.pem')] // cert from nodechef dashboard
        }
    },
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
    appId: process.env.APP_ID
})

I have tried changing the server URL to HTTPS on both the client and the server and every combination in between to no avail.

Many thanks.

1

1 Answers

0
votes

The issue was that I still had a legacy javascript key set. If this optional param set in the Parse Server initialization option then it it completely refuses to connect (quite rightly) using the new JS Client, for which you only need an App ID and Initialisation function.

I can confirm that I didn't need a certificate to connect to my remote database at NodeChef using ?ssl=true in my connection string.

Although embarrassing I'll leave this here, may help someone.