cloud-code

Parse-server cloud code function 'Cannot POST'

放肆的年华 提交于 2019-12-12 08:46:13
问题 Most parts of my migration to open source parse-server are successful, with my data correctly stored, accessible. I am however having problems with cloud code, specifically with running simple curl tests. The initial parse-server installation includes a sample main.js file that contains a hello world function My own parse installation is hosted at '/parse' so URLs use this as the root The following is a simple request test curl -X POST \ -H "X-Parse-Application-Id: myAppId" \ -H "X-Parse-REST

Parse.com getting data from callback URL

泪湿孤枕 提交于 2019-12-12 06:58:34
问题 I'm currently trying to use an API and for the API, the developer console of that app asks the developer to submit a callback URL. Whenever the user of the app does something, it submits a GET request to the callback URL and I can retrieve data from that request. The current url I am using is https://appId:javascript-key=myJavascriptKey@api.parse.com/1/functions/receiveInfo. How can I handle the data, a.k.a the GET parameters, from the GET request? I found an answer on Parse.com that says how

can't execute query.find() in my cloud code

随声附和 提交于 2019-12-12 06:37:27
问题 I have a cloud code that fetch data from 'Core' & HTTP API and do some logic on it. Now I want to send push notification based on the result but the code doesn't even getting executed here is a snippet of code .then(function(result) { for (var i = 0; i < queryObjects.length; i++) { var object = queryObjects[i]; console.log('This will loop for '+queryObjects.length+' times'); var pushQuery = new Parse.Query(Parse.Installation); pushQuery.equalTo('installationID',object.get('installationID'));

How can I clone a Parse Query using the Javascript SDK on Parse Cloud Code?

自古美人都是妖i 提交于 2019-12-12 04:05:46
问题 I want to clone queries because it helps me structure my code better. But, when I try to clone an query, I get an error saying: Object [object Object] has no method 'skip' . Here's the code I've tried: var _ = require('cloud/modules/lodash'); // custom lodash 4.0.0 ... var query = new Query('Class'); var clonedQuery = _.clone(query); // .cloneDeep() doesn't work either clonedQuery.skip(i); // succeeds in unit tests but fails on cloud code var clonedQuery.first(); Note: The underscore _ is

Implementing Cloud Code on Open Source Parse Server

♀尐吖头ヾ 提交于 2019-12-12 03:33:18
问题 I am developing an app using the new Parse Server. I have researched quite a bit, but cannot figure this out. I want to run some server side code (Cloud Code) but I cannot figure out how to even create a Cloud Code file using Heroku and Mongo. Any help is very much appreciated! 回答1: In the root of app create a cloud folder and create a main.js file in that folder and copy the sample contents in the file Parse.Cloud.define('hello', function(req, res) { res.success('Hi'); }); Then in your Index

request.object.id not returning in afterSave() in Cloud Code

情到浓时终转凉″ 提交于 2019-12-12 00:54:07
问题 Parse.Cloud.afterSave(function(request) { var type = request.object.get("type"); switch (type) { case 'inspiration': var query = new Parse.Query("Inspiration"); break; case 'event': var query = new Parse.Query("Event"); break; case 'idea': var query = new Parse.Query("Idea"); break; case 'comment': break; default: return; } if (query) { query.equalTo("shares", request.object.id); query.first({ success: function(result) { result.increment("sharesCount"); result.save(); }, error: function(error

Parse cloud code request.object.get(key) return always undefined

我们两清 提交于 2019-12-12 00:21:59
问题 i'm trying to make a simple check before saving an object on Parse. I'm using the "beforeSave" method to check if object has necessary fields setup correctly before saving. The problem is that when i try to get a field of my object it return always undefined even if it is setup correcly in log! Input: {"original":null,"update":{"ACL":{"abcdefghi":{"read":true,"write":true}},"isDeleted":false,"lastEdit":0,"name":"testobject","uuid":"109d0b30-1ad5-408b-ba49-2ce024935476"}} and cloud code: Parse

Invalid Session Error Parse AfterSave on User in cloud code

China☆狼群 提交于 2019-12-11 22:40:02
问题 I have a question regarding an invalid session token that I am getting in an afterSave method on a user object. I literally run the same query in the beforeSave and the afterSave in Parse cloud code and the one in the before save works while the one in the afterSave does not. I was wondering if there is something that I am not understanding in regards to how Parse works in that I am getting an invalid session token in the afterSave method but no problems in the beforeSave method. Here is the

Parse aftersave cloud function returns a success result but doesn't execute success function

痞子三分冷 提交于 2019-12-11 19:46:18
问题 I'm having trouble getting my aftersave cloud function to increment a value in another data table. The Parse documentation is a bit confusing on this front. I have a table called "CandidateVotes" that stores a row for each vote on a "candidate" - and when a new vote row is saved, I would like to increment the total votes count stored in a different table called "CategoryCandidates" which has a row for each "candidate". So the relevant information: - Votes table is called "CandidateVotes" -

Query entire class vs first object in the class

。_饼干妹妹 提交于 2019-12-11 18:58:27
问题 In my cloud code I want to retrieve the first object in the "Messages" class. Then i want to grab some information from that object, send it to another class, and finally delete that object from the "Messages" class i originally pulled it from. My question is do i need to query the entire "Messages" class just to get the first object in it? I don't want to slow down my app due to inefficient code. Parse.Cloud.afterSave("sendMessage", function(Parse.Message, response) { var body = null; var