{"action":"opened","issue":{"url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2258","repository_url":"https://api.github.com/repos/ParsePlatform/parse-server","labels_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2258/labels{/name}","comments_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2258/comments","events_url":"https://api.github.com/repos/ParsePlatform/parse-server/issues/2258/events","html_url":"https://github.com/ParsePlatform/parse-server/issues/2258","id":165089083,"number":2258,"title":"Save function not working","user":{"login":"AmbroiseCollon","id":2622390,"avatar_url":"https://avatars.githubusercontent.com/u/2622390?v=3","gravatar_id":"","url":"https://api.github.com/users/AmbroiseCollon","html_url":"https://github.com/AmbroiseCollon","followers_url":"https://api.github.com/users/AmbroiseCollon/followers","following_url":"https://api.github.com/users/AmbroiseCollon/following{/other_user}","gists_url":"https://api.github.com/users/AmbroiseCollon/gists{/gist_id}","starred_url":"https://api.github.com/users/AmbroiseCollon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmbroiseCollon/subscriptions","organizations_url":"https://api.github.com/users/AmbroiseCollon/orgs","repos_url":"https://api.github.com/users/AmbroiseCollon/repos","events_url":"https://api.github.com/users/AmbroiseCollon/events{/privacy}","received_events_url":"https://api.github.com/users/AmbroiseCollon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-12T14:06:27Z","updated_at":"2016-07-12T14:06:27Z","closed_at":null,"body":"\r\n### Issue Description\r\n\r\nI have written this script that expires some round from a game :\r\n\r\n```\r\n// Initialize Parse\r\nvar Parse = require('parse/node')\r\nParse.initialize('appId')\r\nParse.serverURL = 'myUrl'\r\n\r\n// Get yesterday same time\r\nvar d = new Date()\r\nconsole.log(d) // eslint-disable-line no-console\r\nvar time = 24 * 3600 * 1000\r\nvar yesterday = new Date(d.getTime() - time)\r\n\r\n// Query for expired round\r\nvar Round = Parse.Object.extend('Round')\r\nvar query1 = new Parse.Query(Round)\r\nquery1.doesNotExist('score1')\r\n\r\nvar query2 = new Parse.Query(Round)\r\nquery2.doesNotExist('score2')\r\n\r\nvar query = Parse.Query.or(query1, query2)\r\nquery.lessThan('createdAt', yesterday)\r\nquery.find({\r\n\tsuccess: function (results) {\r\n\t\tconsole.log('Expiring ' + results.length + ' rounds... ') // eslint-disable-line no-console\r\n\t\tvar rounds = []\r\n\t\tfor (var i = 0; i < results.length; i++) {\r\n\t\t\t// Get round and score\r\n\t\t\tvar round = results[i]\r\n\t\t\tvar score = 0\r\n\t\t\tif (round.get('isSuddenDeath')) {\r\n\t\t\t\tscore = 60 * 1000\r\n\t\t\t}\r\n\r\n\t\t\t// Update round\r\n\t\t\tround.set('completed1', true)\r\n\t\t\tround.set('completed2', true)\r\n\t\t\tif (typeof round.get('score1') === 'undefined') {\r\n\t\t\t\tconsole.log('score 1 undefined')\r\n\t\t\t\tround.set('score1', score)\r\n\t\t\t}\r\n\t\t\tif (typeof round.get('score2') === 'undefined') {\r\n\t\t\t\tconsole.log('score 2 undefined')\r\n\t\t\t\tround.set('score2', score)\r\n\t\t\t}\r\n\r\n\t\t\tconsole.log('score1: ' + round.get('score1'))\r\n\t\t\tconsole.log('score2: ' + round.get('score2'))\r\n\t\t\tconsole.log('completed1: ' + round.get('completed1'))\r\n\t\t\tconsole.log('completed2: ' + round.get('completed2'))\r\n\r\n\t\t\trounds.push(round)\r\n\t\t}\r\n\t\tconsole.log(rounds)\r\n\r\n\t\tParse.Object.saveAll(rounds, {\r\n\t\t\tsuccess: function (savedRounds) {\r\n\t\t\t\tconsole.log('successfully expired ' + savedRounds.length + ' rounds') // eslint-disable-line no-console, max-lea\r\n\t\t\t},\r\n\t\t\terror: function (error) {\r\n\t\t\t\tconsole.log('failed roundExpired with error' + error.message) // eslint-disable-line no-console, max-lea\r\n\t\t\t}\r\n\t\t})\r\n\t},\r\n\terror: function (results, error) {\r\n\t\tconsole.error('Failed to get rounds with error : ' + error.message) // eslint-disable-line no-console, max-lea\r\n\t}\r\n})\r\n\r\n```\r\n\r\nWhen I run it manually or when my cron tab runs it, it fails with an `errorXMLHttpRequest`. What is really disturbing about this is that I found out, when googling, that this error often seems to be linked to Parse server being not reachable. But here it has obviously been reached according to the fact that my first query is ran perfectly (cf logs). Next the code updates my round fields as Expected. But the save method don't work.\r\n \r\n### Environment Setup\r\n\r\n- **Server**\r\n  - parse-server version: 2.2.16\r\n  - Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS\r\n\r\n- **Database**\r\n  - MongoDB version: 3.0.12 (MMAPv1)\r\n  - Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab\r\n\r\n### Logs/Trace\r\n\r\n```\r\nExpiring 5 rounds... \r\nscore 2 undefined\r\nscore1: 3\r\nscore2: 0\r\ncompleted1: true\r\ncompleted2: true\r\nscore 1 undefined\r\nscore 2 undefined\r\nscore1: 0\r\nscore2: 0\r\ncompleted1: true\r\ncompleted2: true\r\nscore 2 undefined\r\nscore1: 0\r\nscore2: 0\r\ncompleted1: true\r\ncompleted2: true\r\nscore 2 undefined\r\nscore1: 5\r\nscore2: 0\r\ncompleted1: true\r\ncompleted2: true\r\nscore 2 undefined\r\nscore1: 7\r\nscore2: 0\r\ncompleted1: true\r\ncompleted2: true\r\n[ ParseObjectSubclass { className: 'Round', _objCount: 0, id: 'P3PzD5pydG' },\r\n  ParseObjectSubclass { className: 'Round', _objCount: 31, id: 'mzeO4JyVd2' },\r\n  ParseObjectSubclass { className: 'Round', _objCount: 62, id: 'owkS20JNFt' },\r\n  ParseObjectSubclass { className: 'Round', _objCount: 93, id: 'BR8m69lBi9' },\r\n  ParseObjectSubclass { className: 'Round', _objCount: 123, id: '4VREsinsjW' } ]\r\nfailed roundExpired with errorXMLHttpRequest failed: {\"UNSENT\":0,\"OPENED\":1,\"HEADERS_RECEIVED\":2,\"LOADING\":3,\"DONE\":4,\"readyState\":4,\"responseText\":\"\",\"responseXML\":\"\",\"status\":504,\"statusText\":null,\"withCredentials\":false}\r\n```"}}
{"actor":{"display_login":"AmbroiseCollon"}}