I've downloaded Parse Starter Project and deployed the Parse Starter Project directly from here to Heroku (I used the button "Deploy to Heroku").
Inside Heroku everything is fine. I tested without any problems (I even saw "I dream of being a website").
When I start my app in Android Studio and use either my phone (Samsung Galaxy S6) or the emulator I always get back the message "Save failed".
Output in Android Studio 2.2.3
I use the following code in StarterApplication.java:
package com.parse.starter;
import android.app.Application;
import android.util.Log;
import com.parse.Parse;
import com.parse.ParseACL;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseUser;
import com.parse.SaveCallback;
public class StarterApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId("applicationId")
.clientKey("clientKey")
.server("https://nameofapp.herokuapp.com/parse/")
.build()
);
ParseObject gameScore = new ParseObject("GameScore");
gameScore.put("score", 1337);
gameScore.put("playerName", "Sean Plott");
gameScore.put("cheatMode", false);
gameScore.saveInBackground(new SaveCallback() {
public void done(ParseException e) {
if (e == null) {
Log.i("Parse", "Save Succeeded");
} else {
Log.i("Parse", "Save Failed");
}
}
});
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
// defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
Why can't I save the data to heroku - where is my mistake?
All keys are put into the code via Copy & Paste and are only unreadable within this question!
Looking forward to your answers and help!
UPDATE: heroku CLI Log: 2016-12-10T15:13:07.221288+00:00 app[web.1]: Uncaught internal server error. { Error: connect ECONNREFUSED 127.0.0.1:27017 2016-12-10T15:13:07.221299+00:00 app[web.1]: at exports._exceptionWithHostPort (util.js:1049:20) 2016-12-10T15:13:07.221299+00:00 app[web.1]: at Object.exports._errnoException (util.js:1026:11) 2016-12-10T15:13:07.221302+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14) 2016-12-10T15:13:07.221303+00:00 app[web.1]: name: 'MongoError', 2016-12-10T15:13:07.221304+00:00 app[web.1]: message: 'connect ECONNREFUSED 127.0.0.1:27017' } Error: connect ECONNREFUSED 127.0.0.1:27017 2016-12-10T15:13:07.221305+00:00 app[web.1]: at Object.exports._errnoException (util.js:1026:11) 2016-12-10T15:13:07.221305+00:00 app[web.1]: at exports._exceptionWithHostPort (util.js:1049:20) 2016-12-10T15:13:07.221306+00:00 app[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14) 2016-12-10T15:13:07.230326+00:00 heroku[router]: at=info method=POST path="/parse/classes/GameScore" host=XXXXXXXXXXXX.herokuapp.com request_id=ca250458-621a-4749-bae9-6882208ae7ba fwd="62.226.173.93" dyno=web.1 connect=0ms service=3ms status=500 bytes=531
heroku logsvia terminal, or if you have a dashboard check logs there - lxknvlk