Hello,
I’d like to re-open this issue because things seem to be broken again.
Same scenario as before - I’m creating some logic (a timer) that works great on debug, but fails to run on the server.
Last time we spoke, you mentioned that your servers use Node v4.3.4. This version doesn’t actually exist. I installed the closest I could, which was v4.3.2. https://nodejs.org/en/download/releases/
My code runs on my local machine using node v4.3.2, but when I publish to the server it does not.
The first part of the timer execution calls a function that returns a promise. The promise aims to authenticate as a “super user” so I can run some global operations - we discussed this idea here: http://support.backendless.com/t/authentication-within-timer.
As mentioned, I created a function that checks the Backendless cache for an auth token, then validates it - if the token doesn’t exist or is invalid, I re-login the “super user” and cache the token.
This pattern works on debug mode. On the server, the function that returns the promise is called…and then the timer shuts off.
module.exports = function authenticate(attempts) {
if(!attempts) {
attempts = 0;
}
console.log('Authenticating...');
var tokenKey = 'superusertoken';
var credentials = { ... };
console.log('...');
return Backendless.Cache.contains(tokenKey).then(exists => {
[...]
The console.log calls before the call to Backendless.Cache succeed, but nothing else happens after that.
From the perspective of the timer, I’ve tried both simply calling the authenticate() function, and returning it back to the execute function. Neither of these show any difference in execution on the server side and in debug mode.
If it helps, I’ve updated CodeRunner to the latest version.
In addition, the log files in production mode have been incredibly slow. I’m trying to run production code + inspect the output immediately after it runs. Right now I’m waiting hours for new logs to come through. Is there a reason this cycle is so slow?