OMG - I think we found it! This promise thing is central, I think…
Just changed, inside the if statement, to:
await user.fetch();
Re-ran. Output below contains a User with data:
data available pre: false,
info: afterSave triggered for Score for user cmwNOTJjhW:,
Input: {“UserID”:{"__type":“Pointer”,“className”:"_User",“objectId”:“cmwNOTJjhW”},“HoleNo”:2,“HoleSI”:3,“Club”:“MAGC”,“HolePar”:4,“CourseName”:“Lakes”,“ScoreGross”:5,“ScoreHcap”:13,“createdAt”:“2020-08-20T21:06:03.625Z”,“updatedAt”:“2020-08-20T21:06:03.625Z”,“objectId”:“8Oi1kXxpi9”} {“className”:“Score”,“triggerType”:“afterSave”,“user”:“cmwNOTJjhW”},
verbose: REQUEST for [GET] /parse/classes/_User/cmwNOTJjhW: {} {“method”:“GET”,“url”:"/parse/classes/_User/cmwNOTJjhW",“headers”:{“user-agent”:“node-XMLHttpRequest, Parse/js2.12.0 (NodeJS 12.16.1)”,“accept”:"/",“content-type”:“text/plain”,“host”:“server:1337”,“content-length”:“161”,“connection”:“close”},“body”:{}},
verbose: RESPONSE from [GET] /parse/classes/_User/cmwNOTJjhW: {,
“response”: {,
“objectId”: “cmwNOTJjhW”,
“username”: “myUsername”,
“phone”: “415-392-0202”,
“emailVerified”: true,
“createdAt”: “2020-08-20T08:59:04.800Z”,
“updatedAt”: “2020-08-20T08:59:27.820Z”,
“ACL”: {,
“": {,
“read”: true,
},
“cmwNOTJjhW”: {,
“read”: true,
“write”: true,
},
},
},
} {“result”:{“response”:{“objectId”:“cmwNOTJjhW”,“username”:“myUsername”,“phone”:“415-392-0202”,“emailVerified”:true,“createdAt”:“2020-08-20T08:59:04.800Z”,“updatedAt”:“2020-08-20T08:59:27.820Z”,“ACL”:{"”:{“read”:true},“cmwNOTJjhW”:{“read”:true,“write”:true}}}}},
data available post: true,
Current User: myUsername,
info: afterSave triggered for Score for user cmwNOTJjhW:,
The output above, line 2 is the end of the afterSave. Is this async performed on a different thread?
The extra Leaderboard query code returns (and so works as intended):
LeaderObject: ParseObject {,
_objCount: 7,,
className: 'Leaderboard',,
id: 'CASm3XDkO9',
},
Captains Captains 2020,