Parse-server: Kue crashes parse server

Created on 17 Mar 2016  Â·  7Comments  Â·  Source: parse-community/parse-server

Environment Setup

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Heroku + MongoLab

Steps to reproduce

I'm trying to use kue for scheduled jobs on my Parse Server. For now I've modified my index.js file like so as stated in the several tutorials I found about Kue :

var express = require('express')
  , kue = require('due')
  , redis = require('redis');

var ParseServer = require('parse-server').ParseServer;

var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;

if (!databaseUri) {
  console.log('DATABASE_URI not specified, falling back to localhost.');
}

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '',
  serverURL: process.env.SERVER_URL
});
// Client-keys like the javascript key or the .NET key are not necessary with parse-server
// If you wish you require them, you can set them as options in the initialization above:
// javascriptKey, restAPIKey, dotNetKey, clientKey

// connect to REDIS
var client = redis.createClient(process.env.REDIS_URL);

var app = express();

// Serve the Parse API on the /parse URL prefix
var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api)
.use(kue.app); // wire up Kue (see /active for queue interface)


// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
  res.status(200).send('I dream of being a web site.');
});

var port = process.env.PORT || 1337;
app.listen(port, function() {
    console.log('parse-server-example running on port ' + port + '.');
});

I've found out that the app crashes at the line : .use(kue.app). Here is the error I get :

Starting process with command `node index.js`
parse-server-example running on port 22995.
/app/node_modules/parse-server/lib/index.js:298
        throw err;
        ^

Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
    at Object.exports._errnoException (util.js:890:11)
    at exports._exceptionWithHostPort (util.js:913:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1057:14)
Process exited with status 7
State changed from starting to crashed

I don't know why this is happening. And I need help on that as I'm not a Node/Express/Redis/Kue/Heroku ninja at all. :)

Why bother ?

I'm setting up a tutorial for anyone trying to get Kue up and running for Parse Server on Heroku. This could be useful according to #153. So any help could help me finish this for the community !

Most helpful comment

Does anyone know of a working tutorial for this. I am having a few problems getting this up and running on my end

All 7 comments

It seems that kue is not able to connect to Redis. Is it Redis installed in your server and the connection (127.0.0.1:6379) valid?

Yeah this seems to be a pretty straightforward error, your Kue instance cannot connect to Redis.

I found out my mistake here. Thank you for your help.

Does anyone know of a working tutorial for this. I am having a few problems getting this up and running on my end

@AmbroiseCollon Did you ever publish the tutorial on using Kue with Parse Server?

@rendragon83 @christianpbrink didn't have time to finish it. But I've detailed a bit my code in #1628. Hope you'll find this helpful.

Thanks!

On Mon, Aug 1, 2016 at 4:31 AM, Ambroise Collon [email protected]
wrote:

@rendragon83 https://github.com/rendragon83 @christianpbrink
https://github.com/christianpbrink didn't have time to finish it. But
I've detailed a bit my code in #1628
https://github.com/ParsePlatform/parse-server/issues/1628. Hope you'll
find this helpful.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ParsePlatform/parse-server/issues/1078#issuecomment-236520097,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAbap4nmgFHaWRFV45UPwtZo4ufiprBtks5qba7bgaJpZM4HzELp
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dpaid picture dpaid  Â·  3Comments

LtrDan picture LtrDan  Â·  4Comments

ViolentCrumble picture ViolentCrumble  Â·  3Comments

lorki picture lorki  Â·  3Comments

pulse1989 picture pulse1989  Â·  3Comments