parse-server: Parse LiveQuery Scalability with Redis Failure

Issue Description

When running separate Parse Server and Parse LiveQuery Servers with Redis for scalability, the Parse Server does not publish to Redis in order to push down new updates to the LiveQuery Servers.

Current Setup is as follows: –MAIN PARSE SERVER–

var api = new ParseServer({
  databaseURI: process.env.DATABASE_URI,
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID,
  masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
  fileKey: process.env.FILE_KEY, // Add the file key to provide access to files already hosted on Parse
  serverURL: process.env.SERVER_URL,  // Don't forget to change to https if needed
  liveQuery: {
    classNames: ["Room","Message"], // List of classes to support for query subscriptions
      redisUrl: process.env.REDIS_URL
  }

–PARSE LIVEQUERY SERVER–

var api = new ParseServer({
    appId: process.env.APP_ID,
    masterKey: process.env.MASTER_KEY,
    serverURL: process.env.SERVER_URL
});

var app = express();

var mountPath = process.env.PARSE_MOUNT || '/leap';
app.use(mountPath, api);

var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);

httpServer.listen(port, function() {
		console.log('parse-live-query-server running on port ' + port + '.');
});

// This will enable the Live Query real-time server
ParseServer.createLiveQueryServer(httpServer, {
  redisURL: process.env.HEROKU_REDIS_TEAL_URL
});

Steps to reproduce

-Create a main parse server app on Heroku, add a Heroku Redis as an Add-on -Create a separate parse LiveQuery server app on Heroku and link to the Redis -Set all environment variables in Heroku accordingly (with REDIS_URL linking to the updating Redis add-on url given when connecting to the Redis Instance) -Upgrade to paid dynos and Redis -Point client app subscriptions at LiveQuery Server URL -Send a new message from subscribed clients

Expected Results

Expect the Main Parse Server to publish the updates to the LiveQuery to Redis to be read by the LiveQuery Server (subscriptions) which in turn would call the handle method in the client.

Actual Outcome

The message was created but the handle method in the client was never called.

Keep in mind that this setup will work when the main parse server and LiveQuery server are run locally with Redis being run from Heroku.

Environment Setup

  • Server

    • parse-server version : 2.5.3
    • Operating System: Heroku Dyno and locally MacOS High Sierra
    • Hardware: Heroku Web App
    • See above description regarding local and Heroku configurations
  • Database MLab

Logs/Trace

Redis shows two active-connections, Main Parse Server shows the creation of the message object, reloading the client view will show the created messages.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

Very old thread but love the last comment 😃 Just passing by trying to find a LiveQuery/Redis config issue I somehow messed up… (and yes, @flovilmart nothing in here helped except your last comment, serious 👍)

There is more than 1000 tests across the board, documentations, examples and the source code to help. I already dedicate way too much time to ‘helping’ which is actually helping no-one.

So I actually would suggest that you take a deep dive into the codebase and start owning and understanding what it does, and start writign those missing documentations.

I am actually getting really tired of this charade where after almost 3 years in the open, so few have written more guides or more docs.

So there’s my answer, use the guides, use the docs, read the code.

It’s not rocket science it’s JavaScript.