Skip to content
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

Parse Cloud always responds "unauthorized" #351

Closed
leonardojobim opened this issue Feb 10, 2016 · 4 comments
Closed

Parse Cloud always responds "unauthorized" #351

leonardojobim opened this issue Feb 10, 2016 · 4 comments
Labels
type:question Support or code-level question

Comments

@leonardojobim
Copy link

I am receiving {"code":141,"error":"Error: undefined unauthorized"} for any Parse Cloud function, even for the simple "hello" function below ( I receive {"error":"unauthorized"}):

My parser-server is hosted in Heroku and using MongoLab.
My cloud/main.js file:

// from https://github.com/ParsePlatform/parse-server/issues/13
var port = process.env.PORT || 1337;
Parse.serverURL = 'https://localhost:' + port + '/parse';

Parse.Cloud.define('hello', function(req, res) {
  res.success('Hi');
});

// Other methods like beforeSave and afterSave ...
@leonardojobim leonardojobim changed the title Parse Cloud always responde "unauthorized" Parse Cloud always responds "unauthorized" Feb 11, 2016
@drew-gross
Copy link
Contributor

Can you run your server with VERBOSE=1 npm start and paste whatever the server outputs when you make the request?

@leonardojobim
Copy link
Author

I suppose that npm start, in this case, is equivalent to node index.js, with no additional script.
I did it, but there was any log information:

screen shot 2016-02-10 at 11 13 01 pm

@drew-gross
Copy link
Contributor

Visiting a path in the browser won't work for two reasons 1) POST is the required HTTP methods for cloud functions and 2) The app ID is required to be submitted with the request. Trying with one of our SDKs should work.

@leonardojobim
Copy link
Author

I accessed the '/hello' cloud function from Swift SDK and it worked. I did not know about these details.
But it was just a bad oversimplification. I related the real problem in a new issue: #356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

4 participants