MongoDB connection issues are shown when try to deploy the and application which has the "$fh.sync.init" override

Solution Verified - Updated -

Issue

  • MongoDB connection issues are shown when try to deploy an application
  • Unable to deploy a cloud application
  • meta_data is missing from some FH.Sync calls
  • The deployment fails and uncaughtException is recorded in a stderr log file.

Following an example of this issue into the logs.

[2017-06-16T16:08:25.626Z] uncaughtException: [Error: MongoDB Client &
Redis Client are not connected. Ensure connect() is called before
calling start]
[2017-06-16T16:08:25.627Z] Internal error: [Error: MongoDB Client &
Redis Client are not connected. Ensure connect() is called before
calling start]
Error: MongoDB Client & Redis Client are not connected. Ensure
connect() is called before calling start
    at start (/home/fh/.fh-npm-node4/fh-mbaas-api/7.0.10/node_modules/fh-sync/lib/sync-server.js:157:11)
    at Object.memoized
(/home/fh/.fh-npm-node4/fh-mbaas-api/7.0.10/node_modules/async/dist/async.js:3623:16)
    at Object.<anonymous>
(/home/fh/.fh-npm-node4/fh-mbaas-api/7.0.10/node_modules/async/dist/async.js:89:12)
    at apply (/home/fh/.fh-npm-node4/fh-mbaas-api/7.0.10/node_modules/async/dist/async.js:20:25)
    at Object.start
(/home/fh/.fh-npm-node4/fh-mbaas-api/7.0.10/node_modules/async/dist/async.js:56:12)
    at Object.init
(/home/fh/.fh-npm-node4/fh-mbaas-api/7.0.10/node_modules/fh-sync/lib/sync-server.js:113:22)
    at Object.<anonymous>
(/home/fh/apps/eshortis-rmrqnknghnujlpxunjufuyjt-demos-dev/src/application.js:25:15)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:968:3

Following an example of a code implementation which will cause this issue.

var datasetId = "myShoppingList";
var syncOptions = {
  syncFrequency: 10,
  clientSyncTimeout: 24*60*60
};
$fh.sync.init(datasetId, syncOptions, function(err){
  if (err) {
    console.error('sync init failed due to error', err);
  } else {
    console.log('sync init finished successfully');
  }
});

Environment

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content