-
-
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
Running a cloud function from Index.js #3253
Comments
I don't think your syntax is quite right on useMasterKey in main.js. Try adjusting your useMasterKey syntax to this:
|
@OpConTech Nope, that still doesn't work. I don't think theres a problem with the function in main.js since the console debug line 'ranCloudFunc' never gets printed to the console. This makes me think the error is happening at the |
Have you tried running your cloudCodeFunction by itself without the calling it so that you are sure that it works? That error message you are getting where it says "unauthorized" will happen when useMasterKey: true syntax is wrong and makes it by the compiler but still does not work correctly. |
@bcootner I managed to reproduce what you were trying, and I succeeded running a cloud function without any problems from index.js. In your main.js file:
In your index.js file:
Run If your demo function in index.js is returning a promise, you cannot use And besides that, on a side note, remember that the Parse JS SDK always returns a |
Issue Description
I can not run a cloud code function (defined in main.js) from an express route (index.js)
In index.js
In main.js
Expected Results
Cloud code function to run when a POST request is made to /test
Console logs should have:
demoFunction start
ranCloudFunc
Actual Outcome
Console logs have:
demoFunction start
ERROR!
ParseError { code: undefined, message: 'unauthorized' }
and the cloud code function does not get performed.
Environment Setup
The text was updated successfully, but these errors were encountered: