1

fellow developers.

I'm migrating an app that was using Parse Hosted and the new code will run inside Node.JS (with express). I am having a bit of a hard time figuring out a problem, though: my JavaScript SDK requests always return "Cannot GET /parse/1/login", as if I was requesting an invalid express route. I know it is valid because if I reproduce the call without the right appID it will return the {"error":"unauthorized"} message.

I'm trying the most basic possible version, using Node.JS code from the Parse docs:

var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();

var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/dev', // Connection string for your MongoDB database
  cloud: '/home/myApp/cloud/main.js', // Absolute path to your Cloud Code
  appId: 'myAppId',
  masterKey: 'myMasterKey', // Keep this key secret!
  fileKey: 'optionalFileKey',
  serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
});

// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);

app.listen(1337, function() {
  console.log('parse-server-example running on port 1337.');
});

The Node.JS server runs OK and I can even query data using cURL requests with no problems at all.

My login code is also the most basic possible version, running directly into the browser console in a page that loads the JS SDK:

Parse.User.logIn("user", "pass", {
  success: function(user) {
    console.log('ok', user);
  },
  error: function(user, error) {
    console.log('error', user, error);
  }
});

The return is simply Cannot GET /parse/1/login (it seems to come from Express, but the message changes if I remove the appID, so I know the Parse Server is getting it). It is worth noting that this very same call worked perfectly if I issue it against api.parse.com servers: {"code":101,"error":"invalid login parameters"}

Any ideas?

1 Answer 1

2

Sorry, guys, I just found out that the problem was the JS SDK Version. Really begginer's mistake, but I just couldn't imagine that it would require changes in the SDK since the new Parse Server should be compatible with the Hosted version.

For the record, I was at JS SDK version 1.6.7 and I updated to the 1.6.14 and it works just fine now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.