Limitations in cloud code

108 views
Skip to first unread message

Jane Sales

unread,
May 24, 2016, 5:38:09 AM5/24/16
to back{4}app
Is there a maximum number of objects returned from a query? (1000 in Parse)

What is the time limit on before / afterSave functions (3 secs in Parse)

What is the time limit on cloud functions (15 secs in Parse)

Davi Macêdo

unread,
May 26, 2016, 6:35:16 PM5/26/16
to back{4}app
Hi, Jane.

Hi Jane. The maximum objects limit is the same of Parse here. 100 by default but you can increase it up to 1000 using limit() function.

Both before / afterSave and cloud functions haven't any limit in back4app up to now.

Best!

Karen Frangulyan

unread,
Mar 5, 2017, 10:08:46 AM3/5/17
to back{4}app
Is the "no time limit on cloud functions" still true? We have a cloud function which works fine on small data but something goes wrong on big data (which takes time to process), like it was killed because of a timeout.

Thanks

casag...@back4app.com

unread,
Mar 7, 2017, 11:49:54 AM3/7/17
to back{4}app
Hello Karen,

The post that you quoted was about results limits, not time limits, so if there is something taking too long to response it will be cut off. What you can do is segment those results in order they require less of the server.

Best!

Karen Frangulyan

unread,
Mar 7, 2017, 5:31:29 PM3/7/17
to back{4}app
Sorry for a long text, but I don't understand what is the difference between results limits and time limits. I got a reply from support telling that the limit is 15 minutes, which means the problem is in our code.

Thinking of a concrete scenario - we make a cloud function call from client app, the cloud function then should create several thousand parse objects, put some connections between them and save all in the DB. Our cloud function uses other helper JS functions defined in different files. It also relies on promises - makes some queries during its work, checks some data, continues processing the data when promises are returned, and so on. Maybe, it will even trigger other cloud functions (not sure if this is the same as calling a plain helper JS function or not). So by result limit (or time limit) do you mean immediate execution of cloud function without all the promises that are triggered? Or maybe all the cloud functions are considered to respond (you also mentioned response time) in a short period of time taking into account the possible promise it returns?

In general, I would like to understand how much work can I do in a cloud function and also memory limit of it (no need to respond to the caller client). Imagine I created 10000 parse objects in my cloud function, sorted them, copy them, set the relations between them (all in JS memory) and then saved them all to the DB - would that work fine?

casag...@back4app.com

unread,
Mar 9, 2017, 8:38:28 AM3/9/17
to back{4}app
Hello Karen,

No worries since now I could understand your question.

The problem on your situation is that since you're having problem with big data it seems that your time response is becoming bigger and bigger and that may cause your function to be stopped.

With the information I told you on the last message (About the query results limitation) you can limit your functions to get objects (1000 at a time) and do all the proccess that you told me your cloud functions do. Regarding the time limit, what you need to understand is that the 15min limit start to be count when the first function is called, so all the functions that it calls after needs to be finished and the proccess terminated on the following 15 minutes or it will be cut off.

Summing up, your code don't seem to be wrong, but it might need to be optimized since what you need to do will require a lot of resources (memory, time...).

If you have any more questions, let us know.

Best!
Reply all
Reply to author
Forward
0 new messages