node.js + express error: cannot read property 'url' of undefined

I'm fairly new to Node.js, installing it to try out the DrupalChat (v7dev) module. I believe this problem is with either node.js or express, as I am beyond the stage where the chat module's settings are loaded. I am faced with the following output when trying to start the chat server

Extension loaded: drupalchat_nodejs.server.extension.js Started http server. info - socket.io started node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ TypeError: Cannot read property 'url' of undefined at Function.handle (/usr/local/lib/node_modules/npm/node_modules/express/node_modules/connect/lib/proto.js:105:18) at Server.app (/usr/local/lib/node_modules/npm/node_modules/express/node_modules/connect/lib/connect.js:60:31) at Server.serverListening (/usr/local/lib/node_modules/npm/node_modules/socket.io/node_modules/policyfile/lib/server.js:136:16) at Server.g (events.js:154:14) at Server.emit (events.js:64:17) at Array.1 (net.js:710:10) at EventEmitter._tickCallback (node.js:192:40)

I remember when express installed, it gave a warning like ".... bugs['web'] should probably be bugs['url']" (I can't remember the prefix)

So is it that the server is trying to read an (API?) variable 'url' but its currently 'web'?

I have all the modules up to date, is it that I should downgrade? Or is there some way of working around this using another module?

EDIT: line 201 is the last very line (delete authenticatedClients[authData.authToken];)... I just added to whole function for proper context

var authenticateClientCallback = function (error, response, body) { if (error) { console.log("Error with authenticate client request:", error); return; } if (response.statusCode == 404) { if (settings.debug) { console.log('Backend authentication url not found, full response info:', response); } else { console.log('Backend authentication url not found.'); } return; } var authData = false; try { authData = JSON.parse(body); } catch (exception) { console.log('Failed to parse authentication message:', exception); if (settings.debug) { console.log('Failed message string: ' + body); } return; } if (!checkServiceKey(authData.serviceKey)) { console.log('Invalid service key "', authData.serviceKey, '"'); return; } if (authData.nodejsValidAuthToken) { if (settings.debug) { console.log('Valid login for uid "', authData.uid, '"'); } setupClientConnection(authData.clientId, authData, authData.contentTokens); authenticatedClients[authData.authToken] = authData; } else { console.log('Invalid login for uid "', authData.uid, '"'); delete authenticatedClients[authData.authToken]; } }

-------------Problems Reply------------

As requested,

The v7 chat module from drupal is not stable. You should not use it in production.

Check bugs : http://drupal.org/project/issues/drupalchat?status=All&categories=All

Check forums : http://drupalchat7.botskool.co.in/?q=forum

Still looking for a new maintener: "New maintainer wanted - please ping beejeebus if you're interested!".

Per @thesnufkin's post, looks like the underlying express version currently pulled is not stable. Roll back to 2.5.9 and you should be good to go:

npm uninstall express npm install [email protected]

I think, maybe, you are trying to use a variable called "url" that wasn't instantiated

can you show your code?

nodejs module has this issue, so I don't think its related to the drupalchat server specifically. Here is the issue for that: http://drupal.org/node/1537702

The option to use node.js as backend in DrupalChat is currently under development. It also depends when (date on which) you downloaded the DrupalChat since the dev code is updated everyday, if new code is committed.

Please raise an issue for the same at this link - http://drupal.org/project/issues/drupalchat?status=All&categories=All.

Thanks,

darklrd

Category:node.js Views:2 Time:2012-04-16

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.252 (s). 11 q(s)