var user = new Parse.User();
user.set("username", "my name");
user.set("password", "my pass");
user.set("email", "[email protected]");
// other fields can be set just like with Parse.Object
user.set("phone", "415-392-0202");
user.signUp(null, {
success: function(user) {
// Hooray! Let them use the app now.
},
error: function(user, error) {
// Show the error message somewhere and let the user try again.
alert("Error: " + error.code + " " + error.message);
}
});
Get error 403
Can you provide logs by running parse-server with VERBOSE=1
I'm using the express server so I can get https. How exactly do I pass that to it?
just set an environment variable VERBOSE=1 before you start parse server. if you start with node server.js that would be VERBOSE=1 node server.js
`var fs = require('fs'),
https = require('https');
var ssl = {
key: fs.readFileSync('./', 'utf8'),
cert: fs.readFileSync('./', 'utf8'),
ca: [fs.readFileSync('./', 'utf8'),
fs.readFileSync('./', 'utf8')]
};
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var databaseUri = ' ';
var port = process.env.PORT || 4337;
//var port = 443;
var api = new ParseServer({
databaseURI: databaseUri,
cloud: __dirname + '/cloud/main.js',
serverURL: 'aa',
appId: 'aa,
'javascriptKey':'aa',
restAPIKey: 'a',
clientKey:'a',
facebookAppIds :['a'],
masterKey: 'a'
});
var app = express();
// Serve the Parse API on the /parse URL prefix
var mountPath = '/a';
app.use(mountPath, api);
app.use(express.static('public'));
// Parse Server plays nicely with the rest of your web routes
app.get('/', function(req, res) {
res.status(200).send('I dream of being a web site.');
});
app.listen(4338,function () { console.log('Server on port 4338'); });
https.createServer(ssl, app)
.listen(port, function() {
console.log('Server running on port ' + port + '.');
});`
I changed all my urls and keys to paste it in here. They are not actuall "a"
I need the server logs, when you're trying to do the login to identify the potential problem.
You mean the logs from the javascript call? Sure one sec
The logs the server is printing in the terminal/console when you run that.
Oh lol, I use the forever service. This ain't running in a console. One second, I will oblige.
There are no logs in the console.
Request URL:https://:4337/Parse/users
Request Method:POST
Status Code:403 Forbidden
Remote Address: :4337
Response Headers
view source
Access-Control-Allow-Headers:*
Access-Control-Allow-Methods:GET,PUT,POST,DELETE,OPTIONS
Access-Control-Allow-Origin:*
Connection:keep-alive
Content-Length:24
Date:Sun, 24 Apr 2016 17:50:00 GMT
X-Powered-By:Express
Request Headers
view source
Accept:*/*
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Content-Length:239
Content-Type:text/plain
DNT:1
Host::4337
Origin:https://:4337
Referer:https://:4337/signup.html
User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Request Payload
view source
{username: "my name", password: "my pass", email: "[email protected]", phone: "415-392-0202",…}
_ApplicationId
:
"a"
_ClientVersion
:
"js1.6.14"
_InstallationId
:
"bf757e4d-1ade-f921-030d-1192034d1356"
email
:
"[email protected]"
password
:
"my pass"
phone
:
"415-392-0202"
username
:
"my name"
Response is {"error":"unauthorized"}
However, our iphone app can accss/create users fine.
those are not the server logs when running with VERBOSE=1, I need the server logs, not the client logs
If that's an issue on the JS SDK so open the issue on the JS SDK repository
I understand, how do I start it with that parameter. Just node index.js VERBOSE=1
You have to understand I'm not a node programmer so the things you think are obvious aren't.
Where exactly is the js api? I'm using the one that used to be hosted on parsecdn. Is there another one?
https://github.com/ParsePlatform/Parse-SDK-JS/issues
Also did you set correctly serverURL in your SDK?
Yes, and I'm using that one, how do I turn on verbose mode? I don't think it's an sdk issue or there'd already be open issues.
It's posting to the correct url in the logs. It's not trying to go to parse.
you set VERBOSE=1 on your server, not on the client SDK
I know, where though? At what point in the index.js above? Or does parse-server module parse command line args?
this is an environment variable. so, just set that environment variable and restart your server. If you don't know how to set an environment variable, I believe stack overflow or google can help you
Oh I know how to linux like a pro.
I don't even know node and I set all of this up.
Well, I set up an issue here: https://github.com/ParsePlatform/Parse-SDK-JS/issues/262
You can probably mark this as closed. Is there a way to force parse-server to always log verbose to a file?
run with VERBOSE=1 and forward the stdout/stderr streams to your log files.
Fairly unprofessional.
Setting env variables isn't a good solution for logging. Please add a feature to set a verbose log file. Thanks anyway.
What do you mean? If you're using forever everything is in the forever docs right on the README.md
And PR's are welcome, I belive there is also a verbose option, that you can set to true, when you create a new ParseServer.
I turned the forever off to run it in the console. I removed the element. So there is a parse server option "verbose"?
So to be clear, since it hasn't added anymore logging or the error is with jssdk,
var api = new ParseServer({
databaseURI: databaseUri,
verbose:true,
I'm not 100% sure if that flag enables the console logs, that's why you can enable the console logs by using VERBOSE=1 as an environment variable.
I did the env variable. Nothing additional came out of the console.
The error is 403 forbidden. Does that mean parse rejected the request ?
that mean the authentication failed. How did you do the environment variable?
[root@localhost ParseServer]#VERBOSE=1
[root@localhost ParseServer]# node index.js
▀ ╢░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░making app
Server on port 4338
Server running on port 4337.
`
that would be VERBOSE=1 node index.js
Also, that's a bad idea to run a server as root...
Parse JavaScript SDK v1.6.14
Most helpful comment
Thanks for this thoughtful response. But as you probably noticed, not only the login is not working for you but also all queries respond with an error. You also probably noticed that your iOS SDK is working correctly with your setup. So I doubt that the error is an issue with parse-server, but most likely an issue with the configuration / javascript SDK.
I'm not really sure what the error is, nor what the problem is. AFAIK, the VERBOSE flag should start spitting out logs and more precisely all request and response logs.
Yes verbose logging requires an environment variable, like express need an environment variable to enable DEBUG logging or the http module needs as well an environment variable to enable more logs.
Again, I can only encourage you to contribute, and if you haven't noticed, I'm not part of Facebook, but a guy like you, having clients relying on their parse instances to work and be transitioned.