code: 206, message: 'Cannot modify user' error even though user got modified correctly
Describe your issue in as much detail as possible. I am trying to save one user from another user. I am using the useMasterKey option so the user gets updated correctly in the database but I still get the error code: 206, message: 'Cannot modify user' Below code is in my cloud function
newMember.set("team", team);
promises.push(newMember.save(null, { useMasterKey : true }));
Steps to reproduce
Please include a detailed list of steps that reproduce the issue. Include curl commands when applicable.
- Call a cloud function from one Parse User
- In the cloud function modify another user with useMasterKey option.
Expected Results
Should not get the error as save has worked correctly
Actual Outcome
code: 206, message: 'Cannot modify user'
Environment Setup
-
Server
- parse-server version (Be specific! Don't say 'latest'.) : 2.2.23
- Operating System: Nodechef Hosted
- Hardware: Nodechef Hosted
- Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Remote Nodechef Hosted
-
Database
- MongoDB version: Nodechef Hosted
- Storage engine: Nodechef Hosted
- Hardware: Nodechef Hosted
- Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): [FILL THIS OUT]
Logs/Trace
You can turn on additional logging by configuring VERBOSE=1 in your environment.
ParseError { code: 206, message: 'Cannot modify user crRDFN8A4S.' } ] } code=141, message=[undefined, undefined, undefined, undefined, code=206, message=Cannot modify user crRDFN8A4S.]
,
,
,
[ ,
message:
code: 141,
[31merror[39m: Error generating response. ParseError {
Error: {"code":141,"message":[null,null,null,null,{"code":206,"message":"Cannot modify user crRDFN8A4S."}]} functionName=notification_update, code=141, message=[undefined, undefined, undefined, undefined, code=206, message=Cannot modify user crRDFN8A4S.], notificationId=GjhhXWWpYl, userId=crRDFN8A4S, type=request, actionPerformed=accepted, isJoinedMember=true, actionPerformedMessage=Pushparaj63 S is already a member of your team., user=dslJ2QuZIl
Input: {"notificationId":"GjhhXWWpYl","userId":"crRDFN8A4S","type":"request","actionPerformed":"accepted"}
[31merror[39m: Failed running cloud function notification_update for user dslJ2QuZIl with:
2016-11-16 04:36:00 App1_globetrekkernightly Input: {"name":"REST","teamname":"rest","leader":{"__type":"Pointer","className":"_User","objectId":"dslJ2QuZIl"},"challenge":{"__type":"Pointer","className":"Challenge","objectId":"QQ7gmrdHDj"},"logo":{"__type":"File","name":"0d200454f6f7a3cb1703bbaa990ac62d_teamlogo.png","url":""},"membersCount":5,"createdBy":{"__type":"Pointer","className":"_User","objectId":"dslJ2QuZIl"},"createdAt":"2016-09-23T08:16:17.769Z","updatedAt":"2016-11-16T04:36:00.839Z","teamStatistics":{"__type":"Pointer","className":"TeamStatistics","objectId":"1xOgjbNDyn"},"objectId":"C97g57yuc3"} className=Team, triggerType=afterSave, user=undefined
[32minfo[39m: afterSave triggered for Team for user undefined:
Result: {"object":{}} className=_User, triggerType=beforeSave, user=undefined
Input: {"email":"[email protected]","surname":"S","emailVerified":true,"username":"[email protected]","updatedAt":"2016-11-16T04:36:00.394Z","firstname":"Pushparaj63","_email_verify_token":"6Bi9dFzjrFWw6FcuyHO4bEkrl","_perishable_token":"1474wkChlMcF6zD7YFytXSesw","createdAt":"2016-10-02T04:14:11.083Z","challenge":{"__type":"Pointer","className":"Challenge","objectId":"QQ7gmrdHDj"},"companyId":"mcoI502xWV","userStatistics":{"__type":"Pointer","className":"UserStatistics","objectId":"vJZ6Nxe5hS"},"garminUserAccessToken":"","garminUserTokenSecret":"","userDetails":{"__type":"Pointer","className":"UserDetails","objectId":"sTdqdkoN8R"},"team":{"__type":"Pointer","className":"Team","objectId":"C97g57yuc3"},"objectId":"crRDFN8A4S"}
[32minfo[39m: beforeSave triggered for _User for user undefined:
No picture change
Validating user **********
Validating [team] attribute value [[object Object]] based on constraint: [dbType], rules: [[object Object]]
Validating team attribute.
Validating [userDetails] attribute value [[object Object]] based on constraint: [dbType], rules: [[object Object]]
Validating userDetails attribute.
Validating [challenge] attribute value [[object Object]] based on constraint: [dbType], rules: [[object Object]]
Validating challenge attribute.
Validating [surname] attribute value [S] based on constraint: [length], rules: [1,50]
Validating [surname] attribute value [S] based on constraint: [dbType], rules: [[object Object]]
Validating surname attribute.
Validating [firstname] attribute value [Pushparaj63] based on constraint: [length], rules: [1,50]
Validating [firstname] attribute value [Pushparaj63] based on constraint: [dbType], rules: [[object Object]]
Validating firstname attribute.
Validating [companyId] attribute value [mcoI502xWV] based on constraint: [dbType], rules: [[object Object]]
Validating companyId attribute.
Result: {"object":{}} className=Team, triggerType=beforeSave, user=undefined
Input: {"name":"REST","teamname":"rest","leader":{"__type":"Pointer","className":"_User","objectId":"dslJ2QuZIl"},"challenge":{"__type":"Pointer","className":"Challenge","objectId":"QQ7gmrdHDj"},"logo":{"__type":"File","name":"0d200454f6f7a3cb1703bbaa990ac62d_teamlogo.png","url":""},"membersCount":5,"createdBy":{"__type":"Pointer","className":"_User","objectId":"dslJ2QuZIl"},"createdAt":"2016-09-23T08:16:17.769Z","updatedAt":"2016-11-16T04:36:00.405Z","teamStatistics":{"__type":"Pointer","className":"TeamStatistics","objectId":"1xOgjbNDyn"},"objectId":"C97g57yuc3"}
[32minfo[39m: beforeSave triggered for Team for user undefined:
resize Key resolved
No picture change
Dirty Key resolved
Validating [challenge] attribute value [[object Object]] based on constraint: [dbType], rules: [[object Object]]
Validating challenge attribute.
Validating [leader] attribute value [[object Object]] based on constraint: [dbType], rules: [[object Object]]
Validating leader attribute.
Validating [membersCount] attribute value [5] based on constraint: [dbType], rules: [[object Object]]
Validating membersCount attribute.
Validating [createdBy] attribute value [[object Object]] based on constraint: [dbType], rules: [[object Object]]
Validating createdBy attribute.
Validating [name] attribute value [REST] based on constraint: [length], rules: [1,75]
Validating [name] attribute value [REST] based on constraint: [dbType], rules: [[object Object]]
Validating name attribute.
} result=true
}
"result": true
"response": {
2016-11-16 04:36:00 App1_globetrekkernightly Input: {"name":"REST","teamname":"rest","leader":{"__type":"Pointer","className":"_User","objectId":"dslJ2QuZIl"},"challenge":{"__type":"Pointer","className":"Challenge","objectId":"QQ7gmrdHDj"},"logo":{"__type":"File","name":"0d200454f6f7a3cb1703bbaa990ac62d_teamlogo.png","url":""},"membersCount":5,"createdBy":{"__type":"Pointer","className":"_User","objectId":"dslJ2QuZIl"},"createdAt":"2016-09-23T08:16:17.769Z","updatedAt":"2016-11-16T04:36:00.405Z","teamStatistics":{"__type":"Pointer","className":"TeamStatistics","objectId":"1xOgjbNDyn"},"objectId":"C97g57yuc3"} className=Team, triggerType=afterSave, user=undefined
[32minfo[39m: afterSave triggered for Team for user undefined:
@flovilmart Any help on this issue.
Does it work locally on your machine?
I dont have a parse server installed on my machine so I never ran it that way.
You should probably test that locally.
I have this issue occur intermittently as well. It only occurs for a fraction of our user saves, and we only see it in Production when running at scale.
Same thing here. I've tested it locally and I'm getting
error: Error generating response. ParseError { code: 206, message: 'Cannot modify user x0o6XhEsFD.' } code=206, message=Cannot modify user x0o6XhEsFD.
error: Cannot modify user x0o6XhEsFD. code=206, message=Cannot modify user x0o6XhEsFD.
after using:
return user.save(null, {useMasterKey: true});
I am having the same problem
Are anyone of you able to one a Pr with a failing unit test?
Just to chime in, I have just found out that I'm getting this from time to time as well, not sure yet what API call generates this... It would be cool if any ParseError thrown from anywhere and then reported to the client would also log 'error' stack trace or something similar to better pinpoint what happened...
I am facing the same isue. Can anyone let me know the final solution for this ? (I am using Parse SDK for iOS)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
facing same issue. Any update?