Search code examples
herokumailgunparse-server

Parse server password reset with Mailgun issue


I'm trying to get the parse-server password reset functionality working, but no success so far. This is my setup:

var api = new ParseServer({
  databaseURI: process.env.DATABASE_URI || process.env.MONGOLAB_IVORY_URI,
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'APP_NAME',
  clientKey: process.env.CLIENT_KEY || 'xxxx', 
  masterKey: process.env.MASTER_KEY || '',
  serverURL: process.env.SERVER_URL || 'https://APP.herokuapp.com/parse',
  appName : 'APP_NAME',
  verifyUserEmails: true,
  publicServerURL: 'https://APP.herokuapp.com/parse',
  emailAdapter: {
    module: 'parse-server-simple-mailgun-adapter',
    options: {
      fromAddress: 'From Name <from@email.com>',
      domain: 'https://api.mailgun.net/v3/***MY_DOMAIN***/messages',
      apiKey: 'key-xxxxxxxxxx',
    }
  }
});

The iOS Parse SDK simply says the email is succesfully sent, but nothing arrives. Also the Mailgun logs show no sign of activity. I have tested this Mailgun setup with curl and that worked just fine.

I tried both https://api.mailgun.net/v3/MY_DOMAIN/messages and https://api.mailgun.net/v3/MY_DOMAIN

Any clue what's wrong with my setup? Or how I can troubleshoot this remotely running Parse setup?


Solution

  • Ok I managed to solve it after hours of digging.

    As it turns out the parse-simple-mailgun-adapter does not handle invalid Mailgun URLs.

    Instead of providing https://api.mailgun.net/v3/MY_DOMAIN, I should have provided just MY_DOMAIN. Appearantly the adapter will construct the url.