Hello!
After upgrading to the latest dev release of August the 1st, or from git today, I get these errors when using nodejs with the chatroom module:
Failed to parse authentication message: { arguments: [ 'ILLEGAL' ],
type: 'unexpected_token',
message: [Getter/Setter],
stack: [Getter/Setter] }
Failed to parse authentication message: { arguments: [ 'ILLEGAL' ],
type: 'unexpected_token',
message: [Getter/Setter],
stack: [Getter/Setter] }
The result is a non-working realtime chat.
Best regards,
Ao
Comments
Comment #1
pavlosdanAlso getting this issue:
Failed to parse authentication message: {}
I am not using chatroom module currently.
My current nodejs.config file looks like this:
backendSettings = {
'scheme': 'http',
'host': 'hostname',
'port': 9080,
'key': '',
'cert': '',
'resource': '/socket.io',
'publishUrl': '/nodejs/publish',
'serviceKey': '',
'backend': {
'port': 8080,
'host': 'hostname',
'authPath': '/nodejs/auth/'
},
'extensions': [],
'clientsCanWriteToChannels': false,
'clientsCanWriteToClients': false,
'clientsCanWriteToClients': false,
'transports': ['websocket', 'flashsocket', 'htmlfile', 'xhr-polling', 'jsonp-polling'],
'jsMinification': true,
'jsEtag': true,
'logLevel': 1
};
The file I had previously didn't seem to work anymore after the upgrade so I created a new one using the example.
Comment #2
Gray Fox commentedFinally got to the bottom of it.
You will have to edit your nodejs.config.js file, as there are few undocumented changes. First the authPath inside backendSettings.backend is no longer used. You can delete that line and put this one (inside backendSettings.backend):
'messagePath': '/nodejs/message/'Next, if your serviceKey is empty (ie. if you're on a development machine), you'll have to edit your nodejs.module file's line 427 and replace
with
Comment #3
Anonymous (not verified) commentedboth of those look like bugs, on it.
Comment #4
taz3r commentedYeah I'm having the same problem.
Running latest dev release from August 1st on Ubuntu with nginx.
After following Gray Fox's instructions, I'm getting the message:
My nodejs.config.js:
And if anyone cares, my NPM list:
Comment #5
Anonymous (not verified) commentedtaz3r, can you update your nodejs.config.js and set backendSettings.debug to true, then report back.
Gray Fox, thanks for the report, the example config issue is fixed with this commit:
http://drupalcode.org/project/nodejs.git/commit/1159da6
and the authKey bug is fixed with:
http://drupalcode.org/project/nodejs.git/commit/4efe47f
Comment #6
taz3r commentedOk, I updated to latest commit.
My backend settings:
A new error pops up when trying to start server:
Comment #7
Anonymous (not verified) commentedrighto, another bug, fixed here:
http://drupalcode.org/project/nodejs.git/commit/3f29a66
thanks for the report.
Comment #8
taz3r commentedThanks! Nodejs running without hitch now.
Comment #9
Anonymous (not verified) commentedyay! closing, please repopen/open other issues if you hit other problems.
Comment #10
Aonoa commentedAfter updating to the latest from git or dev snapshot, I am getting:
Backend authentication url not found.The config is pretty much default:
Best regards,
Ao
Comment #11
Anonymous (not verified) commentedhave you cleared the menu cache?
what happens if you just go to 'http://example.com/nodejs/message/' in your browser? you should see
{"error":"Invalid service key."}Comment #12
Aonoa commentedAh, clearing the cache did the trick. Apparently I forgot that bit.. :)
I'd like to ask if I should use some kind of service key, though?
EDIT: It seems something is still wrong, going to the server stats page, I get this:
Error reading Node.js server stats.Best regards,
Ao
Comment #13
Anonymous (not verified) commentedoh, yep, i forgot to rip out the drupal side of the half-baked stats code. fixed here:
http://drupalcode.org/project/nodejs.git/commit/0629c58
i'm open to the stats stuff coming back, but i'd like it to be a) a sub-module and b) a server extension on the node.js side.
Comment #14
Aonoa commentedThat fixed it. =)
What about:
Is this a bug or a fault in my configuration? There is a huge amount of the flash socket connection invalid messages.
Best regards,
Ao
Comment #15
Anonymous (not verified) commentedthose messages are straight from socket.io code, nothing to do with the node.js module.
i'd look at the socket.io bug reports on github, see if you can find anything.
oh, and make sure you have the lasted stable release of socket.io.
i'm going to close this issue now, please open other specific issues if you hit them.
Comment #17
inolen commentedJust installed the integration module with the notify module, and while it works, node is spitting out the same errors as the OPs:
I'm running node.js 4.10 and using the versions of connect and express as mentioned in the readme.
My nodejs.config.js is practically default, with 'your.nodejs.server.hostname' changed to 'localhost'.
What exactly do these messages mean?
Comment #18
inolen commentedIt turns out my problem was due to the BOM not being stripped out of the JSON reply in authenticateClientCallback(). Evidently this if fixed as of node 0.5.4, but for 0.4.x users you may need to strip it out like so:
Comment #19
rootrau commentedComment #20
rootrau commentedHelp me Error nodejs beta6
Not FoundFailed to parse authentication message: { stack: [Getter/Setter],
arguments: [ 'ILLEGAL' ],
type: 'unexpected_token',
message: [Getter/Setter] }
Failed message string:
404 Not Found
The requested URL /index.php was not found on this server.
Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.
Apache/2.2.15 (CentOS) Server at 127.0.0.1 Port 80
Thanks
Comment #21
inolen commentedWhat version of node are you using?
Comment #22
rootrau commentedI using node version 0.4.10.
Comment #23
inolen commentedIt's probably due to what I mentioned in #18.
The code has changed slightly, but look in authenticateClientCallback in server.js where it calls:
Right before that, try stripping out the byte order marker if it exists:
Comment #24
rootrau commentedThanks inolen.But after I add code
if (requestBody.charCodeAt(0) === 0xFEFF) {
requestBody = requestBody.slice(1);
}
there is this error.
Failed to parse authentication message: { stack: [Getter/Setter],
arguments: [],
type: 'unexpected_eos',
message: [Getter/Setter] }
this code Handle authentication call response.
/**
* Handle authentication call response.
*/
var authenticateClientCallback = function (response) {
var requestBody = '';
response.setEncoding('utf8');
response.on('data', function (chunk) {
var requestBody = chunk.toString();
if (requestBody.charCodeAt(0) === 0xFEFF) {
requestBody = requestBody.slice(1);
}
//requestBody += chunk;
});
response.on('end', function () {
if (response.statusCode == 404) {
if (backendSettings.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(requestBody);
}
catch (exception) {
console.log('Failed to parse authentication message:', exception);
if (backendSettings.debug) {
console.log('Failed message string: ' + requestBody);
}
// return;
}
console.log('authData = ' , authData);
if (!checkServiceKey(authData.serviceKey)) {
console.log('Invalid service key "', authData.serviceKey, '"');
return;
}
if (authData.nodejsValidAuthToken) {
if (backendSettings.debug) {
console.log('Valid login for uid "', authData.uid, '"');
}
setupClientConnection(authData.clientId, authData, authData.contentTokens);
//console.log('co chay 1 lan roi');
authenticatedClients[authData.authToken] = authData;
}
else {
console.log('Invalid login for uid "', authData.uid, '"');
delete authenticatedClients[authData.authToken];
}
});
}
thanks.
Comment #25
inolen commentedIt's now throwing an error because you mutilated the code.
Revert your changes and do exactly what I said in #23 :)
Comment #26
Anonymous (not verified) commentedI am getting a similar error:
My settings:
nodejs v0.4.12
connect v1.1.4
express v2.4.3
nodejs-7.x-1.0-beta6
Site Root: localhost/drupal_sites/enspire_geo_mobile/
nodejs.config.js:
I have also applied the change suggested in #23 to server.js:
Comment #27
Anonymous (not verified) commentedNewb here. Just noticed this issue had been fixed but I am experiencing it using the most recent beta. Please see post #26 for my details.
Comment #28
Anonymous (not verified) commentedI was finally able to get past this by changing to different versions of some of the required node_modules, etc. The version list that finally worked for me:
nodejs v0.4.7
express v2.4.3
connect v1.1.4
socket.io v0.8.7
nodejs-7.x-1.x-dev
Comment #29
robertdouglass commentedThis seems to be still present in the latest .dev version.
Here's my node console output:
Here's my config, generated by the included tool:
I'm using node -v
v0.4.11
Comment #30
robertdouglass commentedI now believe that this is not a problem in the current .dev release. I had made a mistake in my configuration, putting wrong value for "host" for the Drupal site.
Perhaps there should be some targeted error reporting in the node console if it is calling out to a non-existent server?
Comment #32
slv_ commentedHaving a similar problem than the ones reported previously. Have tried everything I can think of right now, but no joy so far.
Configuration file:
Node -v:
v0.6.17
Any help would be really appreciated. Thanks!
Comment #33
slv_ commentedComment #34
slv_ commentedDidn't find the actual problem, but redoing everything from scratch in a new site and a new nodejs server solved the issue, even though the configuration was exactly the same.
I change the status of the issue back to close(fixed)
Comment #35
codesidekick commentedKeeping the issue closed but if anybody else runs into this issue:
Make sure any modules you have that control user access using redirects don't run on the path nodejs/message.
Comment #37
socialnicheguru commented@interactivejunky are you saying that modules like redirect or global_redirect should always exclude 'nodejs/message'?
Comment #38
codesidekick commentedNo idea, sorry, post was from too long ago.