So I did restart the container, and I can see my debug line of code in the console log - so I know my Cloud Code is being executed.
However, from this, I was expecting the whole object and it’s properties to be printed out in the console log…
Parse.Cloud.afterSave("Score", function(request, response) {
newScore = request.object;
console.log("Print the object: " + newScore);
});
The console log contents:
verbose: REQUEST for [POST] /parse/classes/Score: {,
“UserID”: {,
“__type”: “Pointer”,
“className”: “_User”,
“objectId”: “Eysu3hWTlj”,
},
“HoleNo”: 3,
“HoleSI”: 3,
“Club”: “MAGC”,
“HolePar”: 4,
“CourseName”: “Lakes”,
“ScoreGross”: 4,
“ScoreHcap”: 13,
} {“method”:“POST”,“url”:“/parse/classes/Score”,“headers”:{“host”:“my-parse-host.com:1337”,“content-type”:“application/json; charset=utf-8”,“accept”:“/”,“x-parse-session-token”:“token_key”,“x-parse-application-id”:“auction-house”,“x-parse-client-key”:“themasterkey”,“x-parse-installation-id”:“3509ccc2-0552-4d3c-9b62-a9f4c14c7f77”,“x-parse-os-version”:“13.2.2 (18G5033)”,“accept-language”:“en-us”,“accept-encoding”:“gzip, deflate”,“x-parse-client-version”:“i1.17.3”,“content-length”:“174”,“user-agent”:“Parse-2/1 CFNetwork/1120 Darwin/18.7.0”,“connection”:“keep-alive”,“x-parse-app-build-version”:“1”,“x-parse-app-display-version”:“1.0”},“body”:{“UserID”:{“__type”:“Pointer”,“className”:“_User”,“objectId”:“Eysu3hWTlj”},“HoleNo”:3,“HoleSI”:3,“Club”:“MAGC”,“HolePar”:4,“CourseName”:“Lakes”,“ScoreGross”:4,“ScoreHcap”:13}},
Print the object: [object Object],
info: afterSave triggered for Score for user Eysu3hWTlj:,
Input: {“UserID”:{“__type”:“Pointer”,“className”:“_User”,“objectId”:“Eysu3hWTlj”},“HoleNo”:3,“HoleSI”:3,“Club”:“MAGC”,“HolePar”:4,“CourseName”:“Lakes”,“ScoreGross”:4,“ScoreHcap”:13,“createdAt”:“2020-07-06T09:50:16.595Z”,“updatedAt”:“2020-07-06T09:50:16.595Z”,“objectId”:“8BPBInRGSO”} {“className”:“Score”,“triggerType”:“afterSave”,“user”:“Eysu3hWTlj”},
info: afterSave triggered for Score for user Eysu3hWTlj:,
Input: {“UserID”:{“__type”:“Pointer”,“className”:“_User”,“objectId”:“Eysu3hWTlj”},“HoleNo”:3,“HoleSI”:3,“Club”:“MAGC”,“HolePar”:4,“CourseName”:“Lakes”,“ScoreGross”:4,“ScoreHcap”:13,“createdAt”:“2020-07-06T09:50:16.595Z”,“updatedAt”:“2020-07-06T09:50:16.595Z”,“objectId”:“8BPBInRGSO”},
Result: undefined {“className”:“Score”,“triggerType”:“afterSave”,“user”:“Eysu3hWTlj”},
verbose: RESPONSE from [POST] /parse/classes/Score: {,
“status”: 201,
“response”: {,
“objectId”: “8BPBInRGSO”,
“createdAt”: “2020-07-06T09:50:16.595Z”,
},
“location”: “http://my-parse-host.com:1337/parse/classes/Score/8BPBInRGSO”,
} {“result”:{“status”:201,“response”:{“objectId”:“8BPBInRGSO”,“createdAt”:“2020-07-06T09:50:16.595Z”},“location”:“http://my-parse-host.com:1337/parse/classes/Score/8BPBInRGSO”}},
All I have is:
Print the object: [object Object]
If I change to:
console.log("Print the object: " + newScore["HoleNo"]);
It returns:
Print the object: undefined