Skip to content

verifyUserEmails option + mailgun #1219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
goggelj opened this issue Mar 28, 2016 · 3 comments
Closed

verifyUserEmails option + mailgun #1219

goggelj opened this issue Mar 28, 2016 · 3 comments

Comments

@goggelj
Copy link

goggelj commented Mar 28, 2016

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 #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
Copy link
Author

goggelj commented Mar 28, 2016

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 goggelj closed this as completed Mar 28, 2016
@flovilmart
Copy link
Contributor

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

@gowridev
Copy link

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants