0

I am very new to node.js, I just followed the steps to create a simple node.js application. Here it is on github

I ran the command jitsu deploy from the terminal to deploy it on nodejitsu, however I got this error right here, please any help on what could be wrong with code files? Here is the code on git hub

Here is the error that is appearing:

prompt: Is this ok?:  (yes) yes
info:    Creating snapshot 0.0.0-5
info     Uploading: [=============================] 100%
info:    Updating app test
info:    Activating snapshot 0.0.0-5 for test
info:    Starting app test
error:   Error running command deploy
error:   Nodejitsu Error (500): Internal Server Error
error:   There was an error while attempting to deploy the app
error:
error:   Error spawning drone
error:   Script took too long to listen on a socket
error:
error:   This type of error is usually a user error.
error:   Error output from Haibu:
error:
error:   Error: Error spawning drone
error:       at Object.onTimeout [as _onTimeout] (/root/haibu-orchestra/node_mod
ules/haibu/lib/haibu/core/spawner.js:396:15)
error:       at Timer.list.ontimeout (timers.js:101:19)
help:    For help with this error contact Nodejitsu Support:
help:      webchat: <http://webchat.nodejitsu.com/>
help:          irc: <irc://chat.freenode.net/#nodejitsu>
help:        email: <support@nodejitsu.com>
Walls
  • 3,972
  • 6
  • 37
  • 52
Neo
  • 717
  • 2
  • 11
  • 26

2 Answers2

0

You're server.js is exporting a function, but that doesn't get run. Just the body of your start function as top-level code directly inside the server.js module so that it executes when nodejitsu starts your application.

Peter Lyons
  • 142,938
  • 30
  • 279
  • 274
  • His export is being called in `index.js` file, Peter. His `scripts.start` is `node index.js`, not `node server.js`. – Sly Jun 07 '13 at 02:29
0

Nodejitsu is very picky about how quick your deployments listen on the system. There is a certain time frame between the start of deployment and end of deployment before your deployment is considered a failure. When it doesn't listen on a port for so long, it ends up giving you this error.

Rather than using your current start function, why don't you try creating your HTTP socket in index.js and then passing it into your start function as well, since you're already passing routes and handle to it?

For example, in index.js:

var http = require('http'),
    server = http.createServer().listen(8080);

start(server, router.route, handle);

Then, rather than using http.createServer(onRequest).listen(8080) in your server.js file, you can use something like:

var start = function (server, route, handle) {
  function onRequest(request, response) {
    /* Your request stuff here */
  }
  server.on('request', onRequest);
};

This would most likely solve the whole problem.

Sly
  • 1,145
  • 7
  • 19