Skip to content

Console.log for Cloud Code is only called twice and no further. #2390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
StuartMorris0 opened this issue Jul 25, 2016 · 4 comments
Closed

Console.log for Cloud Code is only called twice and no further. #2390

StuartMorris0 opened this issue Jul 25, 2016 · 4 comments

Comments

@StuartMorris0
Copy link

Hello,

I am testing Cloud Code and therefore adding multiple console.log commands. I have found that if there are two logs immediately after each other no further lines are called in the method.

Here is an example:

Parse.Cloud.define('testconsole', function(req, res) {
    console.log('Test hello cloud code function was called.');
    console.log('Test 2.');
    console.log('Test 3');
    console.log('Test 4');
    res.success('Hi');
});

Checking the logs this is all that is received:

2016-07-25T22:29:02.517625+00:00 app[web.1]: Test hello cloud code function was called.
2016-07-25T22:29:02.517775+00:00 app[web.1]: Test 2.

In fact sometimes I also see strange logging for example missing 'Test 3'.

2016-07-25T22:29:02.517625+00:00 app[web.1]: Test hello cloud code function was called.
2016-07-25T22:29:02.517775+00:00 app[web.1]: Test 2.
2016-07-25T22:29:02.517831+00:00 app[web.1]: Test 4

Sometimes the result is returned as nil and sometimes the optional('Hi') as expected.
Any reason for this? Thanks

@steven-supersolid
Copy link
Contributor

console.log() is a built in JS function so not sure if this is an issue with parse-server. Perhaps your hosting solution is not showing all logs? How are you hosting, and how are you viewing logs?

Getting two different results is weird. Are you sure that a load balancer is not hitting app servers with different versions of code deployed? How are you calling your server? Could be an issue with a client SDK or implementation.

@flovilmart
Copy link
Contributor

Also, to collect your logs from cloud code and make them appear in the parse-dashboard logs, you should use req.log.info, req.log.error 

@StuartMorris0
Copy link
Author

So this test was complete on an iOS app calling the cloud code function.

The parse server is hosted on heroku. Viewing the logs via terminal heroku logs or via the heroku logs page for the app, supplied the same result.

@flovilmart
Copy link
Contributor

as @steven-supersolid is mentioning, this is probably heroku throttling the log outputs... there's nothing mutating the node provided console module in parse-server AFAIK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants