-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloud code function responds with error:undefined/unauthorized #546
Comments
The problem was with the Parse-Server initialisation in index.js The migration documents do not mention that its necessary to supply a value for 'serverURL' but unless you do then cloud-code calls won't work correctly.
|
Hello @paulfreeman, where to add this var api? to main.js? or another file? |
That goes wherever you initialise your Parse server. See the link in the README here [https://github.com/ParsePlatform/parse-server#parse-server--express] |
I've seen that but couldn't figure it out too, i'm using nodechef and that's the tree of files i've
i've tried to create app.js and insert into it but didn't work either, thanks a lot for the quick reply! |
Yes in your case app.js is most likely the correct location where express is configured. YMMV, things may have changed since February when I posted the comment |
here's my code, can you give it a look
anything wrong? |
Please check the version of parse-server being used. I had found similar issues with 2.2.12 |
@Yoloabdo, you should contact nodechef support as they're not using the original parse-server |
I have performed a test migration of my Parse db and application to a self-hosted solution.
I have successfully authenticated my PFUser with parse-server with an iOS client.
NB :
I have successfully executed the hello example in main.js using curl to ensure that my parse server endpoint is correctly configured. I can also execute this from my iOS client code. So cloud-functions are working on the desired end-point.
However I am having problems in getting any of my cloud-code Query functions to execute properly.
Here is an example of a test function that has the problem.
This returns an error and prints the following to the console.log(err) call in the parse-server stdout
ParseError { code: undefined, message: 'unauthorized' }
I get this error when calling from inside an iOS app, after authenticating and ensuring that PFUser is valid, or just when calling with curl outside of an established session.
It is unclear to me why the code should be undefined or what is happening here.
Is this a defect or is there something wrong with my cloud code?
I have added the query.userMasterKey = true line having read that this was required in the migration docs. Adding or removing it seems to make no difference.
The text was updated successfully, but these errors were encountered: