You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: Failed running afterLiveQueryEvent on class Message for event create with session r:... with: Error: {"message":"protectedFields.forEach is not a function","code":141}
Steps to reproduce
Run a LiveQuery on class X and then creating+saving a object of class X. E.g. in my case using Swift :
let myClient = ParseLiveQuery.Client()
let lq = myClient.subscribe(queryMessage!)
//... then later ... (much after subscription completes)
let m = Message("hello")
m.saveInBackground { _, error in if error != nil {print(error)} else {print("ok")} }
Actual Outcome
I'm not getting any data in the client from this LiveQuery, and the server says protectedFields.forEach fails. Adding a console.log("protectedFields=",protectedFields) in node_modules/parse-server/lib/Controllers/DatabaseController.js:177 shows protectedFields= { '*': [] } instead of an array, only in this case, whereas it's an array like [] or ["email"] in all other cases (that is, for non-LiveQuery things).
Then I went in Dashboard's Security -> Protected Fields and changed things a bit to see whether the logged value really follows the contents of this form, and so I saw protectedFields= { '*': [ 'stuff', 'moreStuff', 'content' ], authenticated: [ 'otherStuff' ]}. So, when exactly can protectedFields be an array ?
🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
mathieulb
changed the title
LiveQuery: protectedFields.forEach is not a function
LiveQuery error: protectedFields.forEach is not a function
Oct 31, 2023
New Issue Checklist
Issue Description
error: Failed running afterLiveQueryEvent on class Message for event create with session r:... with: Error: {"message":"protectedFields.forEach is not a function","code":141}
Steps to reproduce
Run a LiveQuery on class
X
and then creating+saving a object of classX
. E.g. in my case using Swift :Actual Outcome
I'm not getting any data in the client from this LiveQuery, and the server says
protectedFields.forEach
fails. Adding aconsole.log("protectedFields=",protectedFields)
innode_modules/parse-server/lib/Controllers/DatabaseController.js:177
showsprotectedFields= { '*': [] }
instead of an array, only in this case, whereas it's an array like[]
or["email"]
in all other cases (that is, for non-LiveQuery things).Then I went in Dashboard's Security -> Protected Fields and changed things a bit to see whether the logged value really follows the contents of this form, and so I saw
protectedFields= { '*': [ 'stuff', 'moreStuff', 'content' ], authenticated: [ 'otherStuff' ]}
. So, when exactly canprotectedFields
be an array ?Expected Outcome
No error, and actual LiveQuery results.
Environment
Server
6.3.1
and also5.5.6
Linux
Heroku
Database
MongoDB
3.6.12
Heroku ObjectRocket
Client
iOS (ParseObjC in Swift)
2.7.0
Logs
succeeding :
protectedFields= []
protectedFields= [ 'email' ]
failing :
protectedFields= { '*': [] }
protectedFields= { '*': [ 'stuff', 'moreStuff', 'content' ], authenticated: [ 'otherStuff' ] }
The text was updated successfully, but these errors were encountered: