{"action":"created","issue":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1135","repository_url":"https://api.github.com/repos/ParsePlatform/parse-server","labels_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1135/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1135/comments","events_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1135/events","html_url":"https://github.com/ParsePlatform/parse-server/issues/1135","id":142694285,"number":1135,"title":"Parse.Cloud.afterSave for sending push notifications not working from Heroku server","user":{"login":"bulkwebsolutions","id":6269334,"avatar_url":"https://avatars.githubusercontent.com/u/6269334?v=3","gravatar_id":"","url":"https://api.github.com/users/bulkwebsolutions","html_url":"https://github.com/bulkwebsolutions","followers_url":"https://api.github.com/users/bulkwebsolutions/followers","following_url":"https://api.github.com/users/bulkwebsolutions/following{/other_user}","gists_url":"https://api.github.com/users/bulkwebsolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/bulkwebsolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bulkwebsolutions/subscriptions","organizations_url":"https://api.github.com/users/bulkwebsolutions/orgs","repos_url":"https://api.github.com/users/bulkwebsolutions/repos","events_url":"https://api.github.com/users/bulkwebsolutions/events{/privacy}","received_events_url":"https://api.github.com/users/bulkwebsolutions/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-22T15:55:23Z","updated_at":"2016-03-22T23:22:57Z","closed_at":"2016-03-22T21:05:16Z","body":"I did the migration, from Parse to Heroku and everything went smooth. At this point I didn't have any cloud code or push notifications set up on Parse. When I was done with the migration I begin to implement cloud code to handle push notification every time I save a new text message, but the Parse.Cloud.afterSave method is not running. I know main.js is working because if I implement \r\n\r\n```js\r\nParse.Cloud.define('hello', function(req, res) {\r\n  res.success('Hi');\r\n});\r\n```\r\n\r\nI get \"Hi\" return to my console in Xcode, but for some reason Parse.Cloud.afterSave does nothing. I also know my Parse.Cloud.afterSave code is correct because it's that same code I use on another app through parse though. What am I missing?\r\n\r\nHere in my index.js file:\r\n\r\n```js\r\nvar express = require('express');\r\nvar ParseServer = require('parse-server').ParseServer;\r\nvar path = require('path');\r\n\r\nvar databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;\r\n\r\nif (!databaseUri) {\r\n  console.log('DATABASE_URI not specified, falling back to localhost.');\r\n}\r\n\r\nvar api = new ParseServer({\r\n  databaseURI: databaseUri || '',  \r\n  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',\r\n  appId: process.env.APP_ID || '', \r\n  masterKey: process.env.MASTER_KEY || '', \r\n  fileKey: 'XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', // file key from parse\r\n  serverURL: process.env.SERVER_URL || '',  \r\n\r\n  push: {\r\n    ios: {\r\n      pfx: '/Users/alexcruz/Desktop/Certificates.p12', // The filename of private key and certificate in PFX or PKCS12 format from disk\r\n      bundleId: 'com.daps.DapsPush', // The bundle identifier associate with your app\r\n      production: false // Specifies which environment to connect to: Production (if true) or Sandbox\r\n    }\r\n  }\r\n});\r\n\r\nvar app = express();\r\n\r\n// Serve static assets from the /public folder\r\napp.use('/public', express.static(path.join(__dirname, '/public')));\r\n\r\n// Serve the Parse API on the /parse URL prefix\r\nvar mountPath = process.env.PARSE_MOUNT || '/parse';\r\napp.use(mountPath, api);\r\n\r\n// Parse Server plays nicely with the rest of your web routes\r\napp.get('/', function(req, res) {\r\n  res.status(200).send('Make sure to star the parse-server repo on GitHub!');\r\n});\r\n\r\n// There will be a test page available on the /test path of your server url\r\n// Remove this before launching your app\r\napp.get('/test', function(req, res) {\r\n  res.sendFile(path.join(__dirname, '/public/test.html'));\r\n});\r\n\r\nvar port = process.env.PORT || 1337;\r\nvar httpServer = require('http').createServer(app);\r\nhttpServer.listen(port, function() {\r\n    console.log('parse-server-example running on port ' + port + '.');\r\n});\r\n\r\n// This will enable the Live Query real-time server\r\nParseServer.createLiveQueryServer(httpServer);\r\n```\r\n\r\nHere is my main.js file:\r\n\r\n```\r\n//Push Notification for messages that are received\r\nParse.Cloud.afterSave(\"MXTMessage\", function(request) {\r\n  var messageText = request.object.get('message');\r\n  var usersReceived = request.object.get('receiver');\r\n  var currentUser = Parse.User.current();\r\n  var pushQuery = new Parse.Query(Parse.Installation);\r\n      pushQuery.equalTo('user', usersReceived);\r\n      pushQuery.notEqualTo('user', currentUser);\r\n        Parse.Push.send({\r\n            where: pushQuery, // Set our Installation query\r\n            data: {\r\n              alert: \"New message: \" + messageText\r\n             }\r\n            }, {\r\n      success: function() {\r\n      // Push was successful\r\n          },\r\n      error: function(error) {\r\n        throw \"Got an error \" + error.code + \" : \" + error.message;\r\n          }\r\n            });\r\n});\r\n```\r\n\r\nThank you\r\n"},"comment":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/comments/200076206","html_url":"https://github.com/ParsePlatform/parse-server/issues/1135#issuecomment-200076206","issue_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/1135","id":200076206,"user":{"login":"bulkwebsolutions","id":6269334,"avatar_url":"https://avatars.githubusercontent.com/u/6269334?v=3","gravatar_id":"","url":"https://api.github.com/users/bulkwebsolutions","html_url":"https://github.com/bulkwebsolutions","followers_url":"https://api.github.com/users/bulkwebsolutions/followers","following_url":"https://api.github.com/users/bulkwebsolutions/following{/other_user}","gists_url":"https://api.github.com/users/bulkwebsolutions/gists{/gist_id}","starred_url":"https://api.github.com/users/bulkwebsolutions/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bulkwebsolutions/subscriptions","organizations_url":"https://api.github.com/users/bulkwebsolutions/orgs","repos_url":"https://api.github.com/users/bulkwebsolutions/repos","events_url":"https://api.github.com/users/bulkwebsolutions/events{/privacy}","received_events_url":"https://api.github.com/users/bulkwebsolutions/received_events","type":"User","site_admin":false},"created_at":"2016-03-22T23:22:57Z","updated_at":"2016-03-22T23:22:57Z","body":"\r\n\r\nLine 31 is: liveQuery: {\r\n\r\n`var api = new ParseServer({\r\ndatabaseURI: databaseUri || 'mongodb://localhost:27017/dev', \r\ncloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',\r\nappId: process.env.APP_ID || 'xxxxxxxxxxxxxxxxx',\r\nmasterKey: process.env.MASTER_KEY || 'xxxxxxxxxxxxxxxxx',\r\nfileKey: 'xxxxxxxxxxxxxxxxx', // file key from parse\r\nserverURL: process.env.SERVER_URL || 'http://myapp.herokuapp.com/parse',\r\n\r\npush: {\r\nios: {\r\npfx: '/Users/alexcruz/Desktop/Certificates.p12', // The filename of private key and certificate in PFX or PKCS12 format from disk\r\nbundleId: 'com.daps.DapsPush', // The bundle identifier associate with your app\r\nproduction: false // Specifies which environment to connect to: Production (if true) or Sandbox\r\n}\r\n}\r\n\r\nliveQuery: {\r\nclassNames: [\"MXTMessage\"] // List of classes to support for query subscriptions\r\n}\r\n\r\n});`\r\n"}}