Closed minusplusminus closed 8 years ago
Hm, that error should only occur if you're using the outdated code and the newest version of node.
I just checked and the cloud server is running and working. Can you add some more details about your setup?
Let us know, we'll figure this out!
It's on mac
I'm using Chrome
I'm using the cloud server yes. I've used the master branch
OK, I'm stumped at the moment but will continue to look. If you're using our cloud server (sandbox.spacebrew.cc), it's definitely up, running, and working at the moment. If you're using your own server, I suspect you need to a) update the version of node you're running and/or update to the newest commit from last weekend.
Keep us poster here, we'll figure it out. I've also seen people getting errors if they're using certain Chrome extensions, so try disabling some of those if you continue to get errors?
Maybe this should go unsaid, but, did you connect the publisher and subscriber endpoints?
@minusplusminus Are you still having issues?
+1
I’ve the same issue, on osx, both on chrome (41.0) + safari (8.0) + firefox (35.0). the problem arrives with the public URL (http://spacebrew.github.io/spacebrew/admin/admin.html?server=localhost) and my local URL.
Uncaught TypeError: Cannot read property 'Safetify' of undefined
here is the JS call stack
(anonymous function) (utils.js:33)
(anonymous function) (VM242:18)
(anonymous function) (handlebars-1.0.…beta.6.js:1512)
(anonymous function) (handlebars-1.0.…beta.6.js:1483)
handleConfigMsg (wsevents.js:182)
handleMsg (wsevents.js:69)
ws.onmessage (wsevents.js:39)
Trying to replicate, can't seem to make that happen. Will keep trying to track this down!
@quinkennedy what do you think?
I'm starting to think it has to do with your client/pub/sub/type names. Stringify gets added to the String prototype, and there is also a global Stringify(s) which calls s.Stringify, so I think what is happening is something is calling Stringify(undefined). @minusplusminus you could try setting a breakpoint in utils.js line 24 and refreshing the page to see where that call is coming from and hopefully identifying the client that is exposing the issue.
here is the current problem, val is undefined
.
//handlebar helper so we can use Safetify in our handlebar templates
//{{Safetify some.cool.property}}
Handlebars.registerHelper('Safetify', function(val){
return val.Safetify();
});
I've made a small fix, see my PR https://github.com/Spacebrew/spacebrew/pull/56
Thank you
Thanks @violy are you testing against the public sandbox or a private server? I am not able to reproduce with this: http://spacebrew.github.io/spacebrew/admin/admin.html?server=sandbox.spacebrew.cc
I appreciate the pull request, and it seems like good "graceful failure" handling. I would also like to find the root cause of the problem and not just fix the symptom, hence why I'm still asking questions. Now I guess whatever client has the name "undefined" would lead us to the root cause.
thanks @quinkennedy I’m testing with a local server. I’ll try to find what is undefined.
when I test with button2 sample, with local server,
remoteAddress
's newClient seems to be undefined
see admin/js/wsevents.js
file
ah, so it sounds like something with your and @minusplusminus setup makes the client IP address not populated? I felt like the way we were getting the IP was through a series of assumptions, so it is completely plausible that it is broken now...
The original idea behind using the IP addresses was to limit confusion between who was connected, and to allow for cleaning up of improperly closed connections. Perhaps we should re-evaluate the importance of those goals... @robotconscience ?
@quinkennedy I think that's still important! However, I do know it's an issue between using the earlier version of spacebrew (node v < 10) and the newest in master. Did we end up implementing a version that works with both? @minusplusminus and @violy do you know what version of node you're running and what version of spacebrew?
with my config, msg.config.remoteAddress
is undefined
in
var newClient = {name:msg.config.name, remoteAddress:msg.config.remoteAddress};
the JSON config message don't provide remoteAddress
[{"config":{"name":"button4","description":"This spacebrew client sends and receives boolean messages.","publish":{"messages":[{"name":"buttonPress","type":"boolean","default":"false"}]},"subscribe":{"messages":[{"name":"toggleBackground","type":"boolean"}]},"options":{}}},{"config":{"name":"button6","description":"This spacebrew client sends and receives boolean messages.","publish":{"messages":[{"name":"buttonPress","type":"boolean","default":"false"}]},"subscribe":{"messages":[{"name":"toggleBackground","type":"boolean"}]},"options":{}}}]
is it normal ? I only run my local server with default options, like this node node_server_forever --log
@robotconscience My impulse would be to not worry about node 0.10. The nodejs repo wiki merely states that even versions are stable & odd versions are unstable. This stackoverflow answer states that "only the latest ... version is supported at any given time"
I use node v0.10.30, and my version of spacebrew is the last, cloned from Github. I'm beginner with spacebrew, but the project looks cool !
@violy that's it, then! @quinkennedy it's my bad, I didn't implement a fallback for earlier versions of node. How's this look? I can't test on node 10. now, so LMK if you can?
See this commit for where it goes: https://github.com/Spacebrew/spacebrew/commit/9da52111c981c908d962ef05e49d6a6cc9368c71
var getClientAddress = function(connection){
try{
// old node returns an object
var ret = connection._socket._handle.getpeername();
if ( ret !== null ){
return connection._socket._handle.getpeername().address;
} else {
// new node applies to an object
var out = {};
connection._socket._handle.getpeername(out);
return out.address; //connection.upgradeReq.headers.host;
}
} catch (e){}
logger.log("info", "[printAllTrustedClients] unable to access remote address");
return "unknown";
};
@robotconscience - just to pick up this thread - I had node v0.10.3 as well and was getting this issue. Upgrading to the latest stable version of node fixed the issue for me.
Hi,
I've installed your server and tried to receive data on multiple platforms. But I still cannot get any data back. Even on your cloud server. When I use the admin panel I get:
6utils.js:33 Uncaught TypeError: Cannot read property 'Safetify' of undefined
when an app is started.
When I use your Openframeworks addon, I see the functions, but there's no activity