# Cloud Code

**URL:** https://community.parseplatform.org/c/parse-server/cloud-code/16.md?page=2

[Latest](https://community.parseplatform.org/latest.md) · [Categories](https://community.parseplatform.org/categories.md) · [Tags](https://community.parseplatform.org/tags.md)

**Page:** 3

---

## [How to connect CLP with ACL](https://community.parseplatform.org/t/how-to-connect-clp-with-acl/2914)

<div class="topic-metadata">

**Author:** [@witekmikolajczak](https://community.parseplatform.org/u/witekmikolajczak)\
**Replies:** 1\
**Last updated:** [September 21, 2022, 6:55am UTC](https://community.parseplatform.org/t/how-to-connect-clp-with-acl/2914 "2022-09-21T06:55:43Z")

</div>

Why this Error occurs while trying add object to customClass User: Role: CLP of custom class: Error: error: Parse error: Permission denied for action create on class customClass.

---

## [Get relation changes in afterSave or beforeSave](https://community.parseplatform.org/t/get-relation-changes-in-aftersave-or-beforesave/2915)

<div class="topic-metadata">

**Author:** [@johnbraum](https://community.parseplatform.org/u/johnbraum)\
**Replies:** 6\
**Last updated:** [September 17, 2022, 1:56pm UTC](https://community.parseplatform.org/t/get-relation-changes-in-aftersave-or-beforesave/2915 "2022-09-17T13:56:14Z")

</div>

Heys guys, i have a Class “Department” with a relation “users” and an attribute userCount". I want to set the userCount according to the count of the relation “users”. In beforeSave the changes to the relation aren’t a…

---

## [Why Parse.User.current() returning null?](https://community.parseplatform.org/t/why-parse-user-current-returning-null/2913)

<div class="topic-metadata">

**Author:** [@witekmikolajczak](https://community.parseplatform.org/u/witekmikolajczak)\
**Replies:** 1\
**Last updated:** [September 14, 2022, 11:23am UTC](https://community.parseplatform.org/t/why-parse-user-current-returning-null/2913 "2022-09-14T11:23:23Z")

</div>

Hello, I’m logging my user with \`\`/parse/login\`\`\` endpoint given from parse REST API, which returning my whole logged user object with sessionToken, which is saved to db. Now when in my custom endpoint /parse/function/…

---

## [How to get all objects in relation and their fields?](https://community.parseplatform.org/t/how-to-get-all-objects-in-relation-and-their-fields/2904)

<div class="topic-metadata">

**Author:** [@witekmikolajczak](https://community.parseplatform.org/u/witekmikolajczak)\
**Replies:** 3\
**Last updated:** [September 12, 2022, 3:21pm UTC](https://community.parseplatform.org/t/how-to-get-all-objects-in-relation-and-their-fields/2904 "2022-09-12T15:21:19Z")

</div>

Hello, I’m tired of trying, Problem: I have Team object with relation to TeamLocation object (one-to-many) now i want to get all available teamLocations in team as below with teamLocations subfields. const Tea…

---

## [Cloud trigger - How to detect if data changes done from dashboard?](https://community.parseplatform.org/t/cloud-trigger-how-to-detect-if-data-changes-done-from-dashboard/2874)

<div class="topic-metadata">

**Author:** [@ashish-naik](https://community.parseplatform.org/u/ashish-naik)\
**Replies:** 4\
**Last updated:** [August 28, 2022, 2:25pm UTC](https://community.parseplatform.org/t/cloud-trigger-how-to-detect-if-data-changes-done-from-dashboard/2874 "2022-08-28T14:25:34Z")

</div>

Hello, I use afterSave trigger to send push notifications based on a workflow. it may so happen that i need to fix some data in the that may activate the trigger. I may do this from Dashboard. For such instances, dont …

---

## [Any way to limit included objects?](https://community.parseplatform.org/t/any-way-to-limit-included-objects/2839)

<div class="topic-metadata">

**Author:** [@Topolino](https://community.parseplatform.org/u/Topolino)\
**Replies:** 9\
**Last updated:** [August 21, 2022, 8:27pm UTC](https://community.parseplatform.org/t/any-way-to-limit-included-objects/2839 "2022-08-21T20:27:50Z")

</div>

I am querying a class that has relations to other classes as arrays. I know I can use .include() to have my query on the base class include the array objects for each object. But I want to optimize for speed and limit …

---

## [Strongly typing Parse Classes with Typescript](https://community.parseplatform.org/t/strongly-typing-parse-classes-with-typescript/2797)

<div class="topic-metadata">

**Author:** [@epietrowicz](https://community.parseplatform.org/u/epietrowicz)\
**Replies:** 6\
**Last updated:** [August 17, 2022, 7:43am UTC](https://community.parseplatform.org/t/strongly-typing-parse-classes-with-typescript/2797 "2022-08-17T07:43:08Z")

</div>

I am in the process of converting a Parse Server codebase from Javascript to Typescript – learning Typescript as I go. I would welcome any insight on best practices. I’m wondering what the best way to approach strongly …

---

## [User ACL + Role not working](https://community.parseplatform.org/t/user-acl-role-not-working/2828)

<div class="topic-metadata">

**Author:** [@reptilehaus](https://community.parseplatform.org/u/reptilehaus)\
**Replies:** 2\
**Last updated:** [August 5, 2022, 2:52pm UTC](https://community.parseplatform.org/t/user-acl-role-not-working/2828 "2022-08-05T14:52:39Z")

</div>

I have an object which has: \_wperm: “role:admin” \_rperm: “role:admin” \_acl: role:admin w: true r: true and a user who has been added to the admin group. I am then trying to query a collection like so: await new Pa…

---

## [How to limit values returned to user in query?](https://community.parseplatform.org/t/how-to-limit-values-returned-to-user-in-query/2812)

<div class="topic-metadata">

**Author:** [@cperryoh](https://community.parseplatform.org/u/cperryoh)\
**Replies:** 8\
**Last updated:** [August 1, 2022, 8:00pm UTC](https://community.parseplatform.org/t/how-to-limit-values-returned-to-user-in-query/2812 "2022-08-01T20:00:13Z")

</div>

I am trying to write cloud code that excludes certain values from a query. I have tried using both select() and exclude() to limit what values come back in a query. Here is what my code looks like Parse.Cloud.beforeFind…

---

## [Manage session tokens upon login](https://community.parseplatform.org/t/manage-session-tokens-upon-login/2816)

<div class="topic-metadata">

**Author:** [@cperryoh](https://community.parseplatform.org/u/cperryoh)\
**Replies:** 2\
**Last updated:** [July 29, 2022, 4:54pm UTC](https://community.parseplatform.org/t/manage-session-tokens-upon-login/2816 "2022-07-29T16:54:55Z")

</div>

Hello, I am attempting to use cloud code to manage session tokens upon login. I am looking to have one token per user and when a user logs back in, all their other sessions are terminated. Here is what I have tried so fa…

---

## [How to restrict api calls to verified users?](https://community.parseplatform.org/t/how-to-restrict-api-calls-to-verified-users/2804)

<div class="topic-metadata">

**Author:** [@cperryoh](https://community.parseplatform.org/u/cperryoh)\
**Replies:** 1\
**Last updated:** [July 25, 2022, 5:26pm UTC](https://community.parseplatform.org/t/how-to-restrict-api-calls-to-verified-users/2804 "2022-07-25T17:26:37Z")

</div>

Hello, I have an object type called chunk on my parse server. I would like to restrict the creation of these classes to only users that have verified their email. What validation option in cloud code would I use to accom…

---

## [Return HTTP response earlier in Parse.Cloud.define](https://community.parseplatform.org/t/return-http-response-earlier-in-parse-cloud-define/2796)

<div class="topic-metadata">

**Author:** [@minoo555](https://community.parseplatform.org/u/minoo555)\
**Replies:** 3\
**Last updated:** [July 20, 2022, 3:00pm UTC](https://community.parseplatform.org/t/return-http-response-earlier-in-parse-cloud-define/2796 "2022-07-20T15:00:05Z")

</div>

Hi Parse Community, I defined a custom cloud method using Parse.Cloud.define that perform the deletion of a user’s account. Even tho I can perform the deletion of all user’s entries without any problem, I would like to…

---

## [Can't get the current user in cloud code](https://community.parseplatform.org/t/cant-get-the-current-user-in-cloud-code/2790)

<div class="topic-metadata">

**Author:** [@keanallen](https://community.parseplatform.org/u/keanallen)\
**Replies:** 2\
**Last updated:** [July 19, 2022, 7:40am UTC](https://community.parseplatform.org/t/cant-get-the-current-user-in-cloud-code/2790 "2022-07-19T07:40:20Z")

</div>

Why I can’t get the current user in my cloud code? Even though I pass a header X-Parse-Session-Token, user is still {} Cloud code: Parse.Cloud.define('hello', req =\> { return req.user; // =\> {} }); or Parse.Cloud.de…

---

## [Client-side Cloud Function caching](https://community.parseplatform.org/t/client-side-cloud-function-caching/2792)

<div class="topic-metadata">

**Author:** [@marcus](https://community.parseplatform.org/u/marcus)\
**Replies:** 1\
**Last updated:** [July 13, 2022, 10:48pm UTC](https://community.parseplatform.org/t/client-side-cloud-function-caching/2792 "2022-07-13T22:48:15Z")

</div>

Hi all - We are working on improving the client-side caching of some of our Cloud Functions. We want to be able to rely on client-side http-level caching to accomplish this, but after some searching, it seems like it wo…

---

## [ExpressJS custom middleware code ignored](https://community.parseplatform.org/t/expressjs-custom-middleware-code-ignored/2764)

<div class="topic-metadata">

**Author:** [@cartoonle](https://community.parseplatform.org/u/cartoonle)\
**Replies:** 5\
**Last updated:** [June 30, 2022, 10:33am UTC](https://community.parseplatform.org/t/expressjs-custom-middleware-code-ignored/2764 "2022-06-30T10:33:25Z")

</div>

Hi! I’m trying to implement IP whitelisting to the application, only the users from the IP list should have access to the application. I’ve tried to use the following middleware function, but the status change to 403 i…

---

## [Easiest way to implement 2fa totp](https://community.parseplatform.org/t/easiest-way-to-implement-2fa-totp/2767)

<div class="topic-metadata">

**Author:** [@apidev234](https://community.parseplatform.org/u/apidev234)\
**Replies:** 1\
**Last updated:** [June 27, 2022, 3:04pm UTC](https://community.parseplatform.org/t/easiest-way-to-implement-2fa-totp/2767 "2022-06-27T15:04:47Z")

</div>

Hello im just a newbie and exploring parse. whats the easiest way to implement 2fa totp?

---

## [Checking for (admin) role via CloudCode validation](https://community.parseplatform.org/t/checking-for-admin-role-via-cloudcode-validation/2754)

<div class="topic-metadata">

**Author:** [@jayson](https://community.parseplatform.org/u/jayson)\
**Replies:** 4\
**Last updated:** [June 26, 2022, 9:41am UTC](https://community.parseplatform.org/t/checking-for-admin-role-via-cloudcode-validation/2754 "2022-06-26T09:41:38Z")

</div>

Would this be something you guys recommend to check for the admin role (or any other role for that matter). Anything wrong with this? This would simply check the user calling the method, see if he has that role, and retu…

---

## [Delete PFUser via CloudCode](https://community.parseplatform.org/t/delete-pfuser-via-cloudcode/2710)

<div class="topic-metadata">

**Author:** [@tbrass84](https://community.parseplatform.org/u/tbrass84)\
**Replies:** 6\
**Last updated:** [June 3, 2022, 9:03am UTC](https://community.parseplatform.org/t/delete-pfuser-via-cloudcode/2710 "2022-06-03T09:03:06Z")

</div>

Since Apple is requiring all apps that allow for account creation to also allow for account deletion in app, I am trying to update my app that uses Parse to follow guidelines. I have a CloudCode function set up: Pa…

---

## [Validation failed on nested cloud code functions with requireUser: true](https://community.parseplatform.org/t/validation-failed-on-nested-cloud-code-functions-with-requireuser-true/2696)

<div class="topic-metadata">

**Author:** [@jayson](https://community.parseplatform.org/u/jayson)\
**Replies:** 7\
**Last updated:** [May 28, 2022, 11:09am UTC](https://community.parseplatform.org/t/validation-failed-on-nested-cloud-code-functions-with-requireuser-true/2696 "2022-05-28T11:09:59Z")

</div>

I get this error error: Failed running cloud function testGetAllUsers for user undefined with: Input: {} Error: {"message":"Validation failed. Please login to continue.","code":142} {"error":{"code":142,"message":"V…

---

## [Is there an afterSaveAll hook?](https://community.parseplatform.org/t/is-there-an-aftersaveall-hook/2687)

<div class="topic-metadata">

**Author:** [@fiorex](https://community.parseplatform.org/u/fiorex)\
**Replies:** 1\
**Last updated:** [May 25, 2022, 3:01pm UTC](https://community.parseplatform.org/t/is-there-an-aftersaveall-hook/2687 "2022-05-25T15:01:42Z")

</div>

Hello guys, this is my first post, i would like to know if there is an afterSaveAll hook in the Parse server, that is an afterSave hook that trigger when the sdk call Parse.Object.saveAll(documents) with ALL the new/upd…

---

## [How do I delete files from AWS S3 using the S3Adapter with CloudCode](https://community.parseplatform.org/t/how-do-i-delete-files-from-aws-s3-using-the-s3adapter-with-cloudcode/2683)

<div class="topic-metadata">

**Author:** [@jayson](https://community.parseplatform.org/u/jayson)\
**Replies:** 2\
**Last updated:** [May 25, 2022, 2:10am UTC](https://community.parseplatform.org/t/how-do-i-delete-files-from-aws-s3-using-the-s3adapter-with-cloudcode/2683 "2022-05-25T02:10:39Z")

</div>

I’m looking to delete files off of my S3 bucket on afterDelete('MyImageClass") in CloudCode. I am using the S3Adapter on my ParseServer setup and can save files as expected to my S3 Bucket. But, how do I go about acces…

---

## [Environment variables for local server and testing (Jest)](https://community.parseplatform.org/t/environment-variables-for-local-server-and-testing-jest/2660)

<div class="topic-metadata">

**Author:** [@claesjacobsson](https://community.parseplatform.org/u/claesjacobsson)\
**Replies:** 2\
**Last updated:** [May 10, 2022, 4:52pm UTC](https://community.parseplatform.org/t/environment-variables-for-local-server-and-testing-jest/2660 "2022-05-10T16:52:38Z")

</div>

Not super confident in JS/Node, so need some clarification regarding environment variables. My app is running on Sashido, where I can configure Environment Variables in their dashboard. For running my server locally whi…

---

## [Parse.Cloud.afterSave not trigger when update the data manually](https://community.parseplatform.org/t/parse-cloud-aftersave-not-trigger-when-update-the-data-manually/2650)

<div class="topic-metadata">

**Author:** [@jeevan-ghule](https://community.parseplatform.org/u/jeevan-ghule)\
**Replies:** 1\
**Last updated:** [May 5, 2022, 5:51am UTC](https://community.parseplatform.org/t/parse-cloud-aftersave-not-trigger-when-update-the-data-manually/2650 "2022-05-05T05:51:20Z")

</div>

Hi, I have two microservices, one is used a Parse server and the other is use Postgres client to update data. both are using the same Postgres database If we add entry through Postgres client then Parse serve after save…

---

## [Remove sensitive data from authData](https://community.parseplatform.org/t/remove-sensitive-data-from-authdata/2377)

<div class="topic-metadata">

**Author:** [@rhuanbarreto](https://community.parseplatform.org/u/rhuanbarreto)\
**Replies:** 6\
**Last updated:** [May 7, 2022, 3:13pm UTC](https://community.parseplatform.org/t/remove-sensitive-data-from-authdata/2377 "2022-05-07T15:13:45Z")

</div>

After I save my user using a third party authentication, some sensitive data keeps saved in the user’s authData field, like the external auth token and id of the user. For security reasons, like to prevent exposing this …

---

## [It is possible to trigger Relation?](https://community.parseplatform.org/t/it-is-possible-to-trigger-relation/2652)

<div class="topic-metadata">

**Author:** [@Surmesure](https://community.parseplatform.org/u/Surmesure)\
**Replies:** 3\
**Last updated:** [May 6, 2022, 1:30am UTC](https://community.parseplatform.org/t/it-is-possible-to-trigger-relation/2652 "2022-05-06T01:30:29Z")

</div>

i want to figure out from cloud code when an object has been removed from a relation so that i can edit his contain instead of sending 2 request to the server. (one for removing and one for updating) so what i need is …

---

## [Parse.Config.save - supported server version?](https://community.parseplatform.org/t/parse-config-save-supported-server-version/2630)

<div class="topic-metadata">

**Author:** [@claesjacobsson](https://community.parseplatform.org/u/claesjacobsson)\
**Replies:** 2\
**Last updated:** [May 5, 2022, 6:15am UTC](https://community.parseplatform.org/t/parse-config-save-supported-server-version/2630 "2022-05-05T06:15:24Z")

</div>

From my Cloud Code, I’m getting a Parse.Config object. When I try to save it as described in JavaScript Developers Guide | Parse, I get an error. I am currently running 3.0.0 - is Parse.Config.save() supposed to work on …

---

## [beforeSave data validation](https://community.parseplatform.org/t/beforesave-data-validation/2620)

<div class="topic-metadata">

**Author:** [@claesjacobsson](https://community.parseplatform.org/u/claesjacobsson)\
**Replies:** 6\
**Last updated:** [April 25, 2022, 8:47am UTC](https://community.parseplatform.org/t/beforesave-data-validation/2620 "2022-04-25T08:47:48Z")

</div>

I have a beforeSave on MyClass, but I can’t get the data validation to work/respond at all. What am I missing? What Parse Server version is this supported from? Parse.Cloud.beforeSave(MyClass, (request) =\> { // my b…

---

## [How secure is Cloud Code?](https://community.parseplatform.org/t/how-secure-is-cloud-code/2594)

<div class="topic-metadata">

**Author:** [@jayson](https://community.parseplatform.org/u/jayson)\
**Replies:** 9\
**Last updated:** [April 25, 2022, 8:32am UTC](https://community.parseplatform.org/t/how-secure-is-cloud-code/2594 "2022-04-25T08:32:47Z")

</div>

Can someone help me understand how secure CloudCode is? Like who can access it? Is it publicly available / open like an API? And if someone somehow knows the cloudcode functions, can they just start calling it and wreck…

---

## [What’s causing a memory leak here?](https://community.parseplatform.org/t/what-s-causing-a-memory-leak-here/2602)

<div class="topic-metadata">

**Author:** [@CastAsHuman](https://community.parseplatform.org/u/CastAsHuman)\
**Replies:** 6\
**Last updated:** [April 20, 2022, 12:34pm UTC](https://community.parseplatform.org/t/what-s-causing-a-memory-leak-here/2602 "2022-04-20T12:34:09Z")

</div>

Could anyone please help me find what is the memory leak here? I don’t know how to find it but I’m sure there is one, because every time I run it the server gets slower! Parse.Cloud.job("setupClubs", function() { var g…

---

## [PostgreSQL $in query not working in aggrigation pipeline](https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579)

<div class="topic-metadata">

**Author:** [@jeevan-ghule](https://community.parseplatform.org/u/jeevan-ghule)\
**Replies:** 3\
**Last updated:** [April 11, 2022, 5:01am UTC](https://community.parseplatform.org/t/postgresql-in-query-not-working-in-aggrigation-pipeline/2579 "2022-04-11T05:01:37Z")

</div>

Hi, I am using PostgreSQL as a database. When I am finding data for the country which belongs to given countries list \[{"$match":{“isMetadataSync”:true,“country”:{"$in":\[“india”\]},“isListed”:true}},{"$skip":0},{"$limit…

[Previous page](https://community.parseplatform.org/c/parse-server/cloud-code/16.md?page=1)

[Next page](https://community.parseplatform.org/c/parse-server/cloud-code/16.md?page=3)
