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
{{ message }}
Repository navigation
Error on every Parse.Query.find call from the cloud #705
On my startup of my app I am hitting 2 separate cloud calls. Both of the functions return errors, and I've narrowed it down to the query.find() in my cloud code for both methods.
When I get back to the iOS client, I'm getting a Parse error code 141.
But when I'm in the error callback on the server side of things, the object that is returned in there is
{
code: undefined,
message: unauthorized
}
A little bit more information, as I just added the VERBOSE=1 environment variable. On the calls that are erroring, I get the following message:
And another thing, I am making calls on the client to the database with PFObject.saveInBackground calls, as well as getting with the PFQuery.getFirstObjectInBackgroundWithBlock calls, so that seems to be working. It's only when trying to do it from the cloud code that appears to be not working.
So I'm wondering if I just completely botched something when setting this up possibly since it's saying I'm unauthorized to query, even though the parse server is running.
My DB is hosted on mongoLab and I have been able to hit it via the CURL methods so the URL is correct.
@jiawenzhang I'm not sure where you are referring to setting that. I don't believe I have set anything with that flag.
I'm not sure where to set it either based on the migration guide. It says to pass it as an option into each Parse.Query, so I put it in the object passed into Parse.Query.find() but that did not work.
Previously I was not using the Parse.Cloud.UserMasterKey() function either, but this code was working great on Parse.com hosted server.
@astanton and @jiawenzhang I'm having this exact issue as well, getting a 141 response when attempting to run query.find() [even with usemasteyKey: true]. @astanton where did you add the clientKey to the config? I thought parse-server advised us to not do this...
@msniff16 I don't remember exactly the issue since it has been so long, but I believe my solution was to remove the clientKey from the config. I initially had it in there, then when I removed it, everything was working.
Also wondering how one has gotten this to work. Does anyone know where I could find a fully working query function with parse-server? I am not sure if the syntax is EXACTLY the same as Parse.com or if there have been any changes. From looking through semi relevant threads I have come to the realization that I need to add query.find({ useMasterKey: true }).then( into the query, is this true?
Edit: I have tried tons of different variations of cloud code queries and ALL of them have responded with the 141 error, I have however successfully called the "hello" function that comes standard. Does anyone have any insight?
Activity
jiawenzhang commentedon Feb 27, 2016
did you set useMasterKey: true ?
astanton commentedon Feb 27, 2016
@jiawenzhang I'm not sure where you are referring to setting that. I don't believe I have set anything with that flag.
I'm not sure where to set it either based on the migration guide. It says to pass it as an option into each Parse.Query, so I put it in the object passed into Parse.Query.find() but that did not work.
Previously I was not using the Parse.Cloud.UserMasterKey() function either, but this code was working great on Parse.com hosted server.
[-]Error on every Parse.Query.find call[/-][+]Error on every Parse.Query.find call from the cloud[/+]jiawenzhang commentedon Feb 27, 2016
check this #650
you need to use it like this
astanton commentedon Feb 27, 2016
Thanks I figured it out and it had to do with me passing in the clientKey to the config. Thanks though!
msniff16 commentedon Apr 6, 2016
@astanton and @jiawenzhang I'm having this exact issue as well, getting a 141 response when attempting to run query.find() [even with usemasteyKey: true]. @astanton where did you add the clientKey to the config? I thought parse-server advised us to not do this...
astanton commentedon Apr 6, 2016
@msniff16 I don't remember exactly the issue since it has been so long, but I believe my solution was to remove the clientKey from the config. I initially had it in there, then when I removed it, everything was working.
msniff16 commentedon Apr 11, 2016
Hmm, cannot get it to work even without the config. @astanton which version of the parse-server and parse-php sdk were you running?
Jerland2 commentedon Apr 27, 2016
Also wondering how one has gotten this to work. Does anyone know where I could find a fully working query function with parse-server? I am not sure if the syntax is EXACTLY the same as Parse.com or if there have been any changes. From looking through semi relevant threads I have come to the realization that I need to add query.find({ useMasterKey: true }).then( into the query, is this true?
Edit: I have tried tons of different variations of cloud code queries and ALL of them have responded with the 141 error, I have however successfully called the "hello" function that comes standard. Does anyone have any insight?
TheRyanHickman commentedon Jun 6, 2016
@Jerland2 I am still experiencing the same issue. Any guidance would be very helpful.
Jerland2 commentedon Jun 6, 2016
@TheRyanHickerman
Here is a sample query that works with my Data structure
` saveObject.equalTo("objectId", request.params.objectId);
saveObject.first({
useMasterKey: true,
success: function (Objects) {
}
})
`
Notice the useMasterKey & query.first those were the keys to getting mine to work.