Guesser App question

42 views
Skip to first unread message

Daniel Martinez

unread,
Aug 5, 2015, 1:00:57 AM8/5/15
to ArangoDB
Hello all, 

I'm following the Guesser game project guide and it's a really interesting insight on ArangoDB. Just have a couple of questions that are really bugging me.

I followed the Deployment in Production guide, if I start the server as in node guesser_server.js  i get the message Cannot contact the Database! Terminating....  but if I do the NODE_ENV=production node guesser_server.js the application actually starts in localhost:8000. I can't seem to connect the dots on why this is happening. 

Also, once the application is running on the 8000 port everything seems to work just fine but if I have to add an unknown animal or object to the database I get the error on the front-end "AJAX call failed, cannot update" and on the server the error TypeError=Converting circular structure to JSON (see attached).

Now the funny thing, the application stops but the added animal/objects are getting into the database. How can I fix this? Which is the best approach to resolve this?

Thanks,

Daniel M.




error.png

Max Neunhöffer

unread,
Aug 7, 2015, 9:22:54 AM8/7/15
to ArangoDB
Dear Daniel,
 if you start the server by doing "node guesser_server.js" without setting the environment variable NODE_ENV to "production", then you  will get the message "Cannot contact the Database! Terminating.... " if your Foxx app is in production mode and not in development mode. If you look at the code in iojs/guesser_server.js at around line 30 (master branch), you see

if (app.get('env') == "development") {
    putRoute = "dev/" + putRoute;
    collectionName = "dev_" + collectionName;
}

This uses a feature of the express framework that you can control the development/production behaviour from the environment variable NODE_ENV. This is explained towards the end of step 10 in the README file.
So far this is all intentional.
  Max

Max Neunhöffer

unread,
Aug 7, 2015, 9:31:13 AM8/7/15
to ArangoDB
Also, once the application is running on the 8000 port everything seems to work just fine but if I have to add an unknown animal or object to the database I get the error on the front-end "AJAX call failed, cannot update" and on the server the error TypeError=Converting circular structure to JSON (see attached).

This is almost certainly a different, unrelated problem, which I cannot reproduce so far. When a new question/animal is added, an AJAX call is performed to change stuff in the database. This call goes to the node app, which in turn forwards it to the Foxx app. I have reproduced this problem and am investigating now.

Max Neunhöffer

unread,
Aug 7, 2015, 9:47:23 AM8/7/15
to ArangoDB
It seems that the API of the arangojs has changed. If you change  line 92 of iojs/guesser_server.js
from
             res.send(x);
to
          res.send(x.body);
it seems to work. I have contacted the author of arangojs and will act, depending on what he says.

Max Neunhöffer

unread,
Aug 11, 2015, 5:12:59 AM8/11/15
to ArangoDB
Indeed, there was an API change in the arangojs driver in versionn 3.5.0.
I have updated the app and the whole tutorial and it now works again.
I have also improved the version pinning of the depencies so that now it should continue to work.
Thanks for the bug report.
Reply all
Reply to author
Forward
0 new messages