cloud-code

Parse-server: iOS Push notification

橙三吉。 提交于 2019-12-13 07:01:15
问题 I'm trying to make a push notification, I had set my .p12 files in parse-server/certs folder. Here is my code in my index.js: var api = new ParseServer({ databaseURI: process.env.DATABASE_URI || 'mongodb://localhost:27017/dev', cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js', appId: 'xx', masterKey: 'xx', fileKey: 'xx', clientKey: 'xx', serverURL: 'xx', push: { ios: [ { pdx: 'certs/ParsePushDevelopmentCertificate.p12', // Dev PFX or P12 bundleId: 'bundleId', production:

How to chain functions in Parse CloudCode?

ぐ巨炮叔叔 提交于 2019-12-13 05:48:33
问题 I've done a parse job that checks every "X" time if "emailSent" is false, for each user. If it is, I call a function to send a email and change the "emailSent" to true. That works. My problem is with the function "getMaxId". I need to return the maxid value to change each user "id_client" column, but I don't know how. I've tried this but it doesn't work. This is writing nothing: "console.log("Write somethingggg"); " Here is the code... Parse.Cloud.job("test", function(request, status) { //

Send multiple http request via parse.cloud.httpReq

天涯浪子 提交于 2019-12-13 05:21:27
问题 I'm trying to send multiple HTTP Requests via Parse.Cloud.httpRequest but I get {"code":141,"message":"Error: Can't call success/error multiple times I need to do all requests and put results in " responses " and return responses back so I can use it in another function. OR maybe I'm in the wrong direction if anyone could guide me. Regards Parse.Cloud.define('http', function(request, response) { var query = new Parse.Query(Parse.Installation); var responses = new Array (); for (var i = 0; i <

only first object getting saved in javascript for loop

ⅰ亾dé卋堺 提交于 2019-12-13 03:55:10
问题 On parse.com, Im trying to save an object which includes: a message body, the senders name, the senders id, and the recipients name to a class called "Messages." The object is getting saved correctly, however, when i try to use a for loop in order to save 3 different copies each with a different and random recipient, only the first object gets saved. randUsers is an array with three random users. How do i fix this? function sendLean(leanBody, leanSenderName, leanSenderId, randUsers){ var

Mandrill with parse server not working on heroku migration

痞子三分冷 提交于 2019-12-13 01:43:39
问题 I have migrate app from parse.com to heroku with mLab and everything works fine except cloud code. I am using Mandrill for sending email from parse cloud code which is not working with heroku Here is what I have done so far: Installed mandrill ~0.1.0 into parse-server-example and push the code to heroku app Put the cloud code into '/cloud/main.js' Called the function from iOS app which respond error as: [Error]: Invalid function. (Code: 141, Version: 1.13.0). Here is my code script: Parse

Cannot remove audio data on AWS-S3 in a Parse-Server app

给你一囗甜甜゛ 提交于 2019-12-13 01:24:28
问题 I am having some hard time to make things work properly while using AWS-S3 with Parse-Server on Heroku . On AWS, I have an S3 bucket called mybucket and a user called mybucket-aws with this policy associated: { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::mybucket", "arn:aws:s3:::mybucket/*" ] } ] } Beside, on Heroku I have a parse-server set like this: var express = require('express'); var ParseServer = require('parse-server')

How-to correctly pass params between Parse Cloud Code and the Client? (httpRequest Example)

Deadly 提交于 2019-12-13 01:06:22
问题 I've seen some examples, read the docs and read other question however I'm still not quite sure where to add/properly add params to be passed between Cloud Code and my Client side correctly. For Instance, Here I am creating a new class from a httpRequest in my Cloud Code In my Cloud Code main.js Parse.Cloud.define("POSTfromCloud", function(request, response) { //runs when Parse.Cloud.run("POSTfromCloud") on the client side is called Parse.Cloud.httpRequest({ method: "POST", headers: { "X

Parse: Update Object from Cloud Code

不羁岁月 提交于 2019-12-12 18:55:10
问题 I have created a background job to run every minute. The purpose of it is to delete old or outdated data within the database. In this case, the user submits a time which has an attached timestamp to it, and the two values are stored in arrays times and timestamp . So I wrote my cloud code to check if the times are older than an hour via their timestamps. If so, delete them from the database. However, that's the part I'm having trouble with. Here's my cloud code so you can see what's going on:

Cannot create a pointer to an unsaved ParseObject

此生再无相见时 提交于 2019-12-12 14:28:59
问题 I am having troubles referring to a "User" object from inside a query. I have the following code: Parse.Cloud.define("getTabsBadges", function(request, response) { var UserObject = Parse.Object.extend('User'); var user = new UserObject(); user.id = request.params.userId; // Count all the locked messages sent to the user var receivedMessagesQuery = new Parse.Query('Message'); receivedMessagesQuery.equalTo('status', 'L'); receivedMessagesQuery.equalTo('toUser', user); // THIS LINE GENERATES THE

Updating and saving thousands of objects at once on Parse Server using cloud code. Code doesn't work for more than 2 objects. (Parse.Object.saveAll())

与世无争的帅哥 提交于 2019-12-12 09:28:22
问题 In my parse server I have a class called Stats which contains the columns secondsPlayed (number) and timeScore (number) I am using cloud code to update all the rows in the column timeScore The code below works only when updating and saving 1 or 2 objects results.length . If Parse.Query returns more than 2 results the code crashes and I get the following error. error: Failed running cloud function timeScore for user undefined with: Input: {} Error: {"code":101,"message":"Object not found."}