I’m testing several NodeJS scripts (in the web Files area), and it seems that every time I get some sort of error in the code, I get a 504 error - timed out. I have temporarily upgraded to the Plus plan to get 20 seconds of run time, but the scripts always seems to time out in 7 - 10 seconds.
Is this normal behaviour? I am really struggling to find a way to see what is going on without stepping through the code one line at a time and calling response.send() with debugging.
On another note, how advanced can the NodeJS be? I have an object with prototype methods, but I cannot get it to run.
Please, provide some examples of the code which is causing the described problems. We’ll try to reproduce them and then will be able to give you an answer.
Regards,
Sergey
Looks like you provided the full savemembergame.js script, and I thought this is just a fragment. In this case you’re not using exports.run function - this is what causes TypeError: undefined is not a function.
Your executable script should look like the following:
exports.run = function( request, response )
{
var MemberGame = require('./MemberGame');
var memberGame = new MemberGame();
memberGame.hello();
response.send(memberGame);
}
I am using that way, but I am using the “require” outside of the exports.run, like in your examples, i.e. you don’t put require in the exports.run = function …
var MemberGame = require("./MemberGame");
exports.run = function(request, response)
{
var memberGame = new MemberGame();
memberGame.hello();
response.send(memberGame);
};
Yes they are, but this is just a sample of what I’m using, there is a lot more code. Is there anything you can’t do in NodeJS script code (not that I’m doing anything specific) to help me track down my issue?
My JavaScript object has about 20 “methods” and a timer, i.e. setInterval() within it. Will that work?