parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

verifyUserEmails option + mailgun

Open goggelj opened this issue 10 years ago • 3 comments

My index.js looks like this:

var ParseServer = require('parse-server').ParseServer;
var path = require('path');
var SimpleMailgunAdapter = require('parse-server/lib/Adapters/Email/SimpleMailgunAdapter');
var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;
if (!databaseUri) {
  console.log('DATABASE_URI not specified, falling back to localhost.');
}

  var api = new ParseServer({
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',  // Don't forget to change to https if needed
  liveQuery: {
    classNames: ["Posts", "Comments"] // List of classes to support for query subscriptions
  },
  verifyUserEmails: true, 
  emailAdapter: new SimpleMailgunAdapter({
    apiKey: 'my key',
    domain: 'mg.my.domain',
    fromAddress: '[email protected]'
  })
});

However, the line verifyUserEmails breaks the App. If I replace it with verifyUsersEmails, the app builds successfully and I can interact with it (curl, rest, and connect my ios app to it. However, no emails are sent.

My Parse app resides in a folder called 'parse-server'. I am not sure how it looks in heroku. To be precise, I am not sure if my mail adapter loads correctly

Looking at https://github.com/ParsePlatform/parse-server/pull/583 it should be verifyUserEmails.

If it is verifyUserEmails then why does it break my app? If it is verifyUsersEmails, then why no emails are sent?

As an FYI:

  • I have copied the lib folder from a clone I made of master about a week ago. Could not find the lib folder in current master.
  • tried to replicate this solution:

For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

The following Config Vars are defined in Heroku: APP_ID MASTER_KEY MONGOLAB_URI PARSE_SERVER_REST_API_KEY PARSE_SERVER_CLIENT_KEY

Steps to reproduce

  1. Cloned parse-server-example into ~/heroku/parse-server
  2. Cloned parse master
  3. Copied lib from master to ~/heroku/parse-server
  4. Edited index.js as per above
  5. Registered user from my ios app
  6. Verified that user appears in mlab but not in main parse database (what I am trying to move away from)

Logs/Trace

On success: 2016-03-28T00:24:13.808887+00:00 app[web.1]: parse-server-example running on port .

On crash I just get an H10 error with little meaningful info. After I enabled 'verbose' logging on Heroku, I got this:

/app/node_modules/parse-server/lib/Config.js:103 2016-03-28T00:51:12.991235+00:00 app[web.1]: throw 'An app name is required when using email verification.';

goggelj avatar Mar 28 '16 00:03 goggelj

Issue with setting appName and appServerUrls have been resolved. All good.

This was necessary: var SimpleMailgunAdapter = require('parse-server/lib/Adapters/Email/SimpleMailgunAdapter');

Not sure how this actually works when parse-server does not contain lib folder. Unless me copying it locally from an older repo meant that the module was available to me.

goggelj avatar Mar 28 '16 01:03 goggelj

the lib folder is built when you run npm install after cloning

flovilmart avatar Mar 28 '16 01:03 flovilmart

Can i check email validation using todo app. (please tell me,what changes i need to todo app,so that it can be paired with parse server)?

gowridev avatar Mar 31 '16 11:03 gowridev