cloud-code

How to query objects in the CloudCode beforeSave?

蹲街弑〆低调 提交于 2019-12-20 04:38:51
问题 I'm trying to compare a new object with the original using CloudCode beforeSave function. I need to compare a field sent in the update with the existing value. The problem is that I can't fetch the object correctly. When I run the query I always get the value from the sent object. UPDATE : I tried a different approach and could get the old register ( the one already saved in parse). But the new one, sent in the request, was overridden by the old one . WHAT?! Another issue is that, even

How do I make my cloud code run on my worker dyno instead of web dyno?

雨燕双飞 提交于 2019-12-19 11:47:26
问题 I have a parse server deployed on heroku. I am running some cloud code on my parse server its a code that takes several minutes to run and causes timeout errors on Heroku when run on a web dyno. heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/parse/functions/timeScore My understanding is if I can make the cloud code run on a worker dyno there won't be any timeout error. Is this correct? So now I have a web and worker dyno running on my app. And here is my Procfile

Parse Cloud Code retrieving a user with objectId

孤街浪徒 提交于 2019-12-18 04:15:10
问题 I am trying to get the user object from objectId. I know the objectId is valid. But I can get this simple query to work. What is wrong with it? user is still undefined after the query. var getUserObject = function(userId){ Parse.Cloud.useMasterKey(); var user; var userQuery = new Parse.Query(Parse.User); userQuery.equalTo("objectId", userId); userQuery.first({ success: function(userRetrieved){ console.log('UserRetrieved is :' + userRetrieved.get("firstName")); user = userRetrieved; } });

Issues with Parse Cloud Code Promises

橙三吉。 提交于 2019-12-14 02:59:38
问题 I am trying to work with Parse Cloud Code and use promises to make sure I eliminate any issues with cals being async. I am wanting to query a class, get an object back, build up some JSON, then query some relations of the object (tags, referees) and add them to the JSON to return back for ExpressJS to render. The code I paste is not working but I don't understand why if each time I am returning to project for the next promise to query on. Edit: //Return a single project Parse.Cloud.define(

Parse cloud code error for body-parser on npm start command

≡放荡痞女 提交于 2019-12-13 20:24:54
问题 I have created the project for parse cloud code and now I am trying to start it using node.js When I run start npm command it gives following error. :\Project>npm start > parse-server-example@1.4.0 start C:\Project > node index.js 1 C:\Project\node_modules\express\lib\express.js:89 throw new Error('Most middleware (like ' + name + ') is no longer bundled with Express and must be installed separately. Please see https://github.com/sen chalabs/connect#middleware.'); ^ Error: Most middleware

Parse deploy of cloud code failing with message “Update failed with internal error”

*爱你&永不变心* 提交于 2019-12-13 13:20:13
问题 I've been running Parse cloud code for a few months using CLI version 1.4.1 with no problems. I just updated using the CLI to the latest version, 1.4.2, but now when I deploy I get this output: Uploading source files Finished uploading files Update failed with internal error I've checked for the one problem I see documented elsewhere, which is erroneous quotes around some parse classes like Parse.User and Parse.Installation. It doesn't look like these are my problem. Is there any way to find

TypeError: Object [object Object] has no method ' '

て烟熏妆下的殇ゞ 提交于 2019-12-13 10:42:23
问题 I am getting the following error when I try to create a customer. I tried downgrading Parse. Currently it is running the latest(2.2.8) version but I tried version 1.4.2 too, and I am still getting the following error. What can be the reason for this "TypeError"? TypeError: Object [object Object] has no method 'isString' at request (stripe.js 49:25) at post (stripe.js:117:12) at Object.module.exports.Customers.create (stripe.js:239:16) at main.js:15:22 Main.js: //STRIPE var Stripe = require(

Verifying uniqueness on a batch save with a huge amount of objects - Parse Performance

妖精的绣舞 提交于 2019-12-13 08:14:46
问题 I'm doing a parse batch save requestas follows: Parse.Object.saveAll(nameGenderArrayToSave) nameGenderArrayToSave is an array with thousands of objects to save. I'm also interested in guarante the uniqueness of my data. So I have a beforeSave hook that do it for me: Parse.Cloud.beforeSave("NameGender", function(request, response) { if (!request.object.isNew()) { // Let existing object updates go through response.success(); } var query = new Parse.Query("NameGender"); // Add query filters to

Parse-Server cloud code can't create Role

烂漫一生 提交于 2019-12-13 07:37:34
问题 I have a class called Project for which I create a Parse.Role for read/write permissions. Here's how I create my Role: var roleName = "hasSound_" + ident; var projectRole = new Parse.Role(roleName, new Parse.ACL()); projectRole.getUsers().add(creator); return projectRole.save().then(function(role) { var acl = new Parse.ACL(); acl.setReadAccess(role, true); //give read access to Role acl.setWriteAccess(role, true); //give write access to Role project.setACL(acl); project.save(); }); And here's

How to send Parse user's password to external API Request?

天涯浪子 提交于 2019-12-13 07:35:43
问题 I'm developing an iOS app which the user must login/register an account. But this account must be the same used in some external webservice. The problem is: I want to do some Jobs on Parse to send Push Notifications automatically. To know when Parse Job have to send the Push Notification, I have to login in my external webservice, I mean, I have to send the PFUser Username and Password to my webservice. So there is a way to obtain the user's password in a plaintext in CloudCode? Or there is