1

Having two iOS apps (let us name them appA and appB) both using parse-server hosted on heroku and mailgun, I am facing the problem describe hereafter.

Let me first say that the two apps are unrelated except for the fact they both have user accounts and mail mailgun is used on both to send a confirmation mail when a user creates an account.

appA is working fine, meaning confirmation mail is sent when a new account is created. But appB is no longer working, meaning no confirmation mail is sent when a new account is created.

I have tried to find out what could be the difference between the two, making one work and not the other. I have also read or listened to a few tutorials on the subject, to remind me how I did this kind of settings (back a few months ago). But I can't get hold of any relevant difference and solve my problem, which is to bring appB back to a working state.

Any hint (on what to do or what to look for) by someone with more experience than me in the field would be very much appreciated.

Thanks in advance!

For reference, here is the parse-server index.js for the app which is not working:

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

var databaseUri = process.env.DATABASE_URI || process.env.MONGODB_URI;

if (!databaseUri) {
  console.log('DATABASE_URI not specified, falling back to localhost.');
}

var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://heroku_database',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || '__appId__',
  masterKey: process.env.MASTER_KEY || '__masterKey__',
  filesAdapter: new S3Adapter(
    "__AAKKIII__",
    "pP7Lm16Tt/nTrKq3242Hv",
    "myapp",
    {directAccess: true}
  ),
  serverURL: process.env.SERVER_URL || 'https://myapp.herokuapp.com/parse',
  liveQuery: {
    classNames: ["User", "myappUnit", "myappFieldOne", "myappFieldTwo"]
  },
  emailAdapter: {
    module: 'parse-server-simple-mailgun-adapter',
    options: {
      fromAddress: 'parse@example.com',
      domain: 'mydomain.net',
      apiKey: 'key-fjdfijofd',
    }
  }
});

var app = express();

app.use('/public', express.static(path.join(__dirname, '/public')));

var mountPath = process.env.PARSE_MOUNT || '/parse';
app.use(mountPath, api);

app.get('/', function(req, res) {
  res.status(200).send('I dream of being a website.  Please star the parse-server repo on GitHub!');
});

app.get('/test', function(req, res) {
  res.sendFile(path.join(__dirname, '/public/test.html'));
});

var port = process.env.PORT || 1337;
var httpServer = require('http').createServer(app);
httpServer.listen(port, function() {
    console.log('parse-server-example running on port ' + port + '.');
});

ParseServer.createLiveQueryServer(httpServer);
Michel
  • 10,303
  • 17
  • 82
  • 179
  • Do you see any differences between the two apps in `heroku logs -tail` when an email is sent? – brennan Apr 11 '17 at 04:48
  • Yes, I see indeed a big difference. In the case of the working app there are about 10 lines of trace in the logs when a new account is created and another few lines when the email verification link is clicked. In the case of the non-working app there is simply nothing in the logs. I can verify that the account is created in the database though, but no verification mail appears. Is there a list of things I could check to see if all is set as it should? – Michel Apr 11 '17 at 07:57
  • Can we see the parse server `index.js`? Are the two apps sharing the same parse server? You could also compare the environment variables with `heroku run printenv` – brennan Apr 11 '17 at 11:45
  • No the two apps have their own parse-server. – Michel Apr 12 '17 at 01:57
  • The result of running "heroku run printenv" seems very similar in both cases. – Michel Apr 12 '17 at 02:09
  • How about the `index.js` for each parse server? Any differences? – brennan Apr 12 '17 at 02:17
  • I just edited the post to include the index.js for the parse-server of the app with a problem. I haven't catched any difference hitting my eyes. I fear there may simply be something wrong on the side of the faulty app. – Michel Apr 12 '17 at 02:27

1 Answers1

0

After searching the net, trying different things and taking a closer look, I ended up by finding what was missing. I put it here in case that may help someone in the future.

The missing lines in the parse-server index.js in my post are those:

  • verifyUserEmails: true,
  • appName: 'Parse App',

The lines above need to be included inside:

var api = new ParseServer({
......
})
Michel
  • 10,303
  • 17
  • 82
  • 179