parse-server-mailgun configuration issue - node.js

I am working on an iOS app using parse-server (/Heroku) as a back-end.
I would like to implement an email-confirmation system when a user creates an account, and also allow email recovery of lost passwords.
For that I want to use mailGun. I have installed the adapter by running:
npm install --save parse-server-mailgun
I have also added this to the ParseServer configuration block.
verifyUserEmails: true,
emailAdapter: {
//module: 'parse-server-simple-mailgun-adapter',
module: '#parse/simple-mailgun-adapter',
//module: '#parse-server-mailgun',
options: {
// The address that your emails come from
fromAddress: 'me#abc.com',
// Your domain from mailgun.com
domain: 'something.com',
// Your API key from mailgun.com
apiKey: 'mykey-mykey-mykey-mykey-mykey-mykey',
}
}
But it is not working. I don't know if I forgot some important step, other than the two above. Or if my configuration is wrong. I must admit I am not confident about the line above reading:
module: '#parse/simple-mailgun-adapter',
Here is what I get when running the push:
git add . && git commit -m "update myapp" && git push heroku master
2018-03-08T09:03:3......0 app[api]: - Build started by user me
.....
2018-03-08T09:03:3......0 app[api]: Build succeeded
2018-03-08T09:03:5......0 heroku[web.1]: State changed from crashed to starting
2018-03-08T09:04:0......0 heroku[web.1]: Starting process with command `npm start`
.....
2018-03-08T09:04:0......0 app[web.1]: > node index.js
2018-03-08T09:04:0......0 app[web.1]:undefined
2018-03-08T09:04:1......0 app[web.1]:
2018-03-08T09:04:1......0 app[web.1]: /app/node_modules/parse-server/lib/Config.js:174
2018-03-08T09:04:1......0 app[web.1]: throw 'An app name is required for e-mail verification and password resets.';
2018-03-08T09:04:1......0 app[web.1]: ^
2018-03-08T09:04:1......0 app[web.1]: An app name is required for e-mail verification and password resets.
2018-03-08T09:04:1......0 app[web.1]: npm ERR! code ELIFECYCLE
2018-03-08T09:04:1......0 app[web.1]: npm ERR! errno 1
2018-03-08T09:04:1......0 app[web.1]: npm ERR! parse-server-example#1.4.0 start: `node index.js`
2018-03-08T09:04:1......0 app[web.1]: npm ERR! Exit status 1
2018-03-08T09:04:1......0 app[web.1]: npm ERR!
2018-03-08T09:04:1......0 app[web.1]: npm ERR! Failed at the parse-server-example#1.4.0 start script.
2018-03-08T09:04:1......0 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely ...
2018-03-08T09:04:1......0 app[web.1]:
2018-03-08T09:04:1......0 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-03-08T09:04:1......0 app[web.1]: npm ERR! ....-debug.log
2018-03-08T09:04:1......0 heroku[web.1]: Process exited with status 1
2018-03-08T09:04:1......0 heroku[web.1]: State changed from starting to crashed
2018-03-08T09:04:1......0 heroku[web.1]: State changed from crashed to starting
2018-03-08T09:04:1......0 heroku[web.1]: Starting process with command `npm start`
2018-03-08T09:04:2......0 app[web.1]:
2018-03-08T09:04:2......0 app[web.1]: > parse-server-example#1.4.0 start /app
2018-03-08T09:04:2......0 app[web.1]: > node index.js
2018-03-08T09:04:2......0 app[web.1]:undefined
2018-03-08T09:04:2......0 app[web.1]:
2018-03-08T09:04:2......0 app[web.1]: /app/node_modules/parse-server/lib/Config.js:174
2018-03-08T09:04:2......0 app[web.1]: throw 'An app name is required for e-mail verification and password resets.';
2018-03-08T09:04:22.996195+00:00 app[web.1]: ^
2018-03-08T09:04:22.996197+00:00 app[web.1]: An app name is required for e-mail verification and password resets.
2018-03-08T09:04:23.011936+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-03-08T09:04:23.012286+00:00 app[web.1]: npm ERR! errno 1
2018-03-08T09:04:23.013532+00:00 app[web.1]: npm ERR! parse-server-example#1.4.0 start: `node index.js`
We can read 'An app name is required for e-mail verification and password resets.' But I am not sure where to fix that.
Beside I need to clarify that the app is working as expected, before I get into trying to install this mailGun adapter.

The error indicates appName property is not configured. It throws because the default email template references appName. There are two ways to configure appName:
If you start your parse-server with a config.json file, add it to the config.json like this:
config.json: { "allowClientClassCreation": false,
...
"appName": "my_app_name",
...
}
Alternatively, set the appName with env variable:
PARSE_SERVER_APP_NAME="my_app_name"
references:
Your best guide is the code:
https://github.com/parse-community/parse-server/blob/637326d3afcf82a4118f5ad5b316e6ae52fb5910/src/Options/Definitions.js
Documentation:
https://parseplatform.org/parse-server/api/4.5.0/#email-verification-and-password-reset
https://parseplatform.org/parse-server/api/master/ParseServerOptions.html

Related

Need help deploying full stack website to heroku: Error: There is likely additional logging output above

I'm pretty new to fullstack development and have been trying to upload my site on heroku, I get this error message and I'm guessing it has something to do with my package-lock.json file in the root folder.
I have both front end and back end folders under one parent folder.
Here is the link to the small project if you can check it out: https://github.com/manuelmort/tft-project
I usually upload some small sites to gh-pages but since they dont support server side code I have to use heroku. It builds succesfully but the site never starts because of the error message below on heroku CLI
2022-01-04T16:23:14.000000+00:00 app[api]: Build started by user manuelmort#gmail.com
2022-01-04T16:24:54.111750+00:00 app[api]: Deploy 8cc070c4 by user manuelmort#gmail.com
2022-01-04T16:24:54.111750+00:00 app[api]: Release v13 created by user manuelmort#gmail.com
2022-01-04T16:24:57.562224+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-04T16:25:02.000000+00:00 app[api]: Build succeeded
2022-01-04T16:25:04.610196+00:00 heroku[web.1]: Starting process with command `npm start`
2022-01-04T16:25:07.018112+00:00 app[web.1]:
2022-01-04T16:25:07.018129+00:00 app[web.1]: > tft-project#1.0.0 start /app
2022-01-04T16:25:07.018130+00:00 app[web.1]: > concurrently "npm run backend" "npm run client"
2022-01-04T16:25:07.018130+00:00 app[web.1]:
2022-01-04T16:25:07.022660+00:00 app[web.1]: sh: 1: concurrently: not found
2022-01-04T16:25:07.028749+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-04T16:25:07.028977+00:00 app[web.1]: npm ERR! syscall spawn
2022-01-04T16:25:07.029095+00:00 app[web.1]: npm ERR! file sh
2022-01-04T16:25:07.029286+00:00 app[web.1]: npm ERR! errno ENOENT
2022-01-04T16:25:07.034404+00:00 app[web.1]: npm ERR! tft-project#1.0.0 start: `concurrently "npm run backend""npm run client"`
2022-01-04T16:25:07.034446+00:00 app[web.1]: npm ERR! spawn ENOENT
2022-01-04T16:25:07.034492+00:00 app[web.1]: npm ERR!
2022-01-04T16:25:07.034537+00:00 app[web.1]: npm ERR! Failed at the tft-project#1.0.0 start script.
2022-01-04T16:25:07.034580+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likelyadditional logging output above.
2022-01-04T16:25:07.040214+00:00 app[web.1]:
2022-01-04T16:25:07.040320+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-04T16:25:07.040356+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-04T16_25_07_034Z-debug.log
2022-01-04T16:25:07.238236+00:00 heroku[web.1]: Process exited with status 1
2022-01-04T16:25:07.301484+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-04T16:25:07.307500+00:00 heroku[web.1]: State changed from crashed to starting
2022-01-04T16:25:15.521992+00:00 heroku[web.1]: Starting process with command `npm start`
2022-01-04T16:25:17.284061+00:00 app[web.1]:
2022-01-04T16:25:17.284072+00:00 app[web.1]: > tft-project#1.0.0 start /app
2022-01-04T16:25:17.284073+00:00 app[web.1]: > concurrently "npm run backend" "npm run client"
2022-01-04T16:25:17.284073+00:00 app[web.1]:
2022-01-04T16:25:17.298996+00:00 app[web.1]: sh: 1: concurrently: not found
2022-01-04T16:25:17.316611+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2022-01-04T16:25:17.317012+00:00 app[web.1]: npm ERR! syscall spawn
2022-01-04T16:25:17.317189+00:00 app[web.1]: npm ERR! file sh
2022-01-04T16:25:17.317369+00:00 app[web.1]: npm ERR! errno ENOENT
2022-01-04T16:25:17.337279+00:00 app[web.1]: npm ERR! tft-project#1.0.0 start: `concurrently "npm run backend""npm run client"`
2022-01-04T16:25:17.337583+00:00 app[web.1]: npm ERR! spawn ENOENT
2022-01-04T16:25:17.337807+00:00 app[web.1]: npm ERR!
2022-01-04T16:25:17.337920+00:00 app[web.1]: npm ERR! Failed at the tft-project#1.0.0 start script.
2022-01-04T16:25:17.338041+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likelyadditional logging output above.
2022-01-04T16:25:17.347983+00:00 app[web.1]:
2022-01-04T16:25:17.350592+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-01-04T16:25:17.350682+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2022-01-04T16_25_17_338Z-debug.log
2022-01-04T16:25:17.534240+00:00 heroku[web.1]: Process exited with status 1
2022-01-04T16:25:17.755577+00:00 heroku[web.1]: State changed from starting to crashed
Any help would be much appreciated!
Turns out I needed to have concurrently under dependencies and not devDependecies branch in my package.json file,
I don't get the error anymore

How to fix npm ERR! code ELIFECYCLE when deploying MEAN app to Heroku

I'm having an issue deploying my backend to Heroku. I'm using the MEAN stack with a Mongo Atlas Database. The app works fine locally. But once I deploy it, it crashes with an npm ERR! code ELIFECYCLE. Apparently, Mongo Atlas requires you to whitelist IP addresses. An article I read said it would work fine if I add my connection string to Heroku environment variables. So I've done so and saved it with the name connectionString. However, this did not work. Does the connection string need a specific name? I've posted my Heroku log below. Note I've tried deleting my node_modules and package.json and reinstalling them as well as changing my node version to 10.x.
2021-03-17T07:22:23.865572+00:00 app[api]: Deploy 2cbf3bbb by user example#example.com
2021-03-17T07:22:23.865572+00:00 app[api]: Release v9 created by user example#example.com
2021-03-17T07:22:24.515688+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-17T07:22:25.000000+00:00 app[api]: Build succeeded
2021-03-17T07:22:27.638401+00:00 heroku[web.1]: Starting process with command `npm start`
2021-03-17T07:22:30.298270+00:00 app[web.1]:
2021-03-17T07:22:30.298283+00:00 app[web.1]: > backend#1.1.1 start /app
2021-03-17T07:22:30.298284+00:00 app[web.1]: > node index.js
2021-03-17T07:22:30.298284+00:00 app[web.1]:
2021-03-17T07:22:31.387500+00:00 app[web.1]: WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
2021-03-17T07:22:31.387844+00:00 app[web.1]: WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
2021-03-17T07:22:31.931808+00:00 heroku[web.1]: State changed from starting to up
2021-03-17T07:23:01.761238+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-17T07:23:01.761850+00:00 app[web.1]: npm ERR! errno 1
2021-03-17T07:23:01.770367+00:00 app[web.1]: npm ERR! backend#1.1.1 start: `node index.js`
2021-03-17T07:23:01.770621+00:00 app[web.1]: npm ERR! Exit status 1
2021-03-17T07:23:01.770728+00:00 app[web.1]: npm ERR!
2021-03-17T07:23:01.772482+00:00 app[web.1]: npm ERR! Failed at the backend#1.1.1 start script.
2021-03-17T07:23:01.772597+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-17T07:23:01.781656+00:00 app[web.1]:
2021-03-17T07:23:01.781807+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-17T07:23:01.781869+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-17T07_23_01_773Z-debug.log
2021-03-17T07:23:01.841833+00:00 heroku[web.1]: Process exited with status 1
2021-03-17T07:23:01.965241+00:00 heroku[web.1]: State changed from up to crashed
2021-03-17T07:23:01.973670+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-17T07:23:06.945061+00:00 heroku[web.1]: Starting process with command `npm start`
2021-03-17T07:23:11.079200+00:00 app[web.1]:
2021-03-17T07:23:11.079239+00:00 app[web.1]: > backend#1.1.1 start /app
2021-03-17T07:23:11.079239+00:00 app[web.1]: > node index.js
2021-03-17T07:23:11.079239+00:00 app[web.1]:
2021-03-17T07:23:12.636407+00:00 app[web.1]: WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
2021-03-17T07:23:12.639137+00:00 app[web.1]: WARNING: See https://github.com/lorenwest/node-config/wiki/Strict-Mode
2021-03-17T07:23:13.442612+00:00 heroku[web.1]: State changed from starting to up
2021-03-17T07:23:43.404828+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-03-17T07:23:43.405294+00:00 app[web.1]: npm ERR! errno 1
2021-03-17T07:23:43.419129+00:00 app[web.1]: npm ERR! backend#1.1.1 start: `node index.js`
2021-03-17T07:23:43.419414+00:00 app[web.1]: npm ERR! Exit status 1
2021-03-17T07:23:43.419741+00:00 app[web.1]: npm ERR!
2021-03-17T07:23:43.420082+00:00 app[web.1]: npm ERR! Failed at the backend#1.1.1 start script.
2021-03-17T07:23:43.420380+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-03-17T07:23:43.437105+00:00 app[web.1]:
2021-03-17T07:23:43.439175+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-03-17T07:23:43.439472+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-03-17T07_23_43_421Z-debug.log
2021-03-17T07:23:43.562438+00:00 heroku[web.1]: Process exited with status 1
2021-03-17T07:23:43.638872+00:00 heroku[web.1]: State changed from up to crashed```
So I figured out the problem. I was using the config module to load the Mongodb Atlas connection string when connecting to my database.
mongoose.connect(config.get('configurationString'), {useNewUrlParser: true, useUnifiedTopology: true, useFindAndModify: false, useCreateIndex: true}).then(() => winston.info("Connected to MongoDB..."))
I changed config.get('connectionString') to process.env.MONGODB_URL then I added the MONGODB_URL env variable to heroku using heroku config:set MONGODB_URL="<YOUR MONGODB ATLAS CONNECTION STRING>". Also make sure you have a Procfile and add the line web:node index.js

Node app can't find module when run on Heroku dyno

I have a node.js app, an API, that works with heroku local yet does not run at a remote dyno. Specifically, it fails with the following message after being built:
2018-02-19T21:19:38.000000+00:00 app[api]: Build started by user ---
2018-02-19T21:20:01.874321+00:00 heroku[web.1]: State changed from crashed to starting
2018-02-19T21:20:01.588534+00:00 app[api]: Release v16 created by user ---
2018-02-19T21:20:01.588534+00:00 app[api]: Deploy c3f854a0 by user ---
2018-02-19T21:19:38.000000+00:00 app[api]: Build succeeded
2018-02-19T21:20:03.954335+00:00 heroku[web.1]: Starting process with command `npm start`
2018-02-19T21:20:05.841898+00:00 app[web.1]: [heroku-exec] Starting
2018-02-19T21:20:06.353423+00:00 app[web.1]:
2018-02-19T21:20:06.353446+00:00 app[web.1]: > saasaato-backend#1.0.5 start /app
2018-02-19T21:20:06.353449+00:00 app[web.1]: > node dist/server.js
2018-02-19T21:20:06.353451+00:00 app[web.1]:
2018-02-19T21:20:06.443156+00:00 app[web.1]: module.js:544
2018-02-19T21:20:06.443160+00:00 app[web.1]: throw err;
2018-02-19T21:20:06.443161+00:00 app[web.1]: ^
2018-02-19T21:20:06.443163+00:00 app[web.1]:
2018-02-19T21:20:06.443165+00:00 app[web.1]: Error: Cannot find module '/app/dist/server.js'
2018-02-19T21:20:06.443169+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:542:15)
2018-02-19T21:20:06.443171+00:00 app[web.1]: at Function.Module._load (module.js:472:25)
2018-02-19T21:20:06.443173+00:00 app[web.1]: at Function.Module.runMain (module.js:682:10)
2018-02-19T21:20:06.443175+00:00 app[web.1]: at startup (bootstrap_node.js:191:16)
2018-02-19T21:20:06.443177+00:00 app[web.1]: at bootstrap_node.js:613:3
2018-02-19T21:20:06.448738+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2018-02-19T21:20:06.449100+00:00 app[web.1]: npm ERR! errno 1
2018-02-19T21:20:06.450147+00:00 app[web.1]: npm ERR! saasaato-backend#1.0.5 start: `node dist/server.js`
2018-02-19T21:20:06.450299+00:00 app[web.1]: npm ERR! Exit status 1
2018-02-19T21:20:06.450518+00:00 app[web.1]: npm ERR!
2018-02-19T21:20:06.450686+00:00 app[web.1]: npm ERR! Failed at the saasaato-backend#1.0.5 start script.
2018-02-19T21:20:06.450842+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-02-19T21:20:06.458437+00:00 app[web.1]:
2018-02-19T21:20:06.458601+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-02-19T21:20:06.458706+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-02-19T21_20_06_451Z-debug.log
2018-02-19T21:20:06.518039+00:00 heroku[web.1]: Process exited with status 1
2018-02-19T21:20:06.535280+00:00 heroku[web.1]: State changed from starting to crashed
A previous heroku release of this app works but I'm unable to figure out what has gone wrong. I have tried setting heroku to not cache any files, double-checked node & npm versions, etc. Any help would be greatly appreciated!
Your application script is as follows:
"scripts": {
"start": "node dist/server.js"
}
As per your start command, i can say your main file server.js present inside dist folder and to start your application its must and should.
Since you added it in .gitignore that folder and server files were not pushed to heroku, As a result you were getting this error. That was the main cause.
.gitignore is mainly used to avoid pushing files like node_modules , unit_test reports and coverage, and log file to your git repository. you should not add your main file which was cause this issue till now. See this for more on .gitignore files

While deploying to heroku , I am getting the following error log

I have used Postgresql add-on and NodeJS framework.In .gitignore file , I have already added npm-debug.log.
2016-09-07T23:35:01.785651+00:00 app[web.1]: npm ERR! node server.js
2016-09-07T23:35:01.785817+00:00 app[web.1]: npm ERR! You can get their info via:
2016-09-07T23:35:01.785982+00:00 app[web.1]: npm ERR! npm owner ls version3
2016-09-07T23:35:01.789051+00:00 app[web.1]:
2016-09-07T23:35:01.789307+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-09-07T23:35:01.789464+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2016-09-07T23:35:01.888595+00:00 heroku[web.1]: State changed from starting to crashed
2016-09-07T23:35:01.878834+00:00 heroku[web.1]: Process exited with status 1
Do you have all dependencies listed in your package.json file?
To add a library to package.json,
npm install<libName> --save

Heroku Log "npm err"

I deployed an app to heroku, which worked, but when I go to the link, I get an application error. When I go to the heroku logs in my console, this is what I see:
2015-05-11T21:35:28.450778+00:00 app[web.1]: npm ERR!
2015-05-11T21:35:28.451031+00:00 app[web.1]: npm ERR! Failed at the showtrackr#0.0.0 start script 'node ./bin/www'.
2015-05-11T21:35:28.458702+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-05-11T21:35:28.451298+00:00 app[web.1]: npm ERR! This is most likely a problem with the showtrackr package,
2015-05-11T21:35:28.470607+00:00 app[web.1]:
2015-05-11T21:35:28.448240+00:00 app[web.1]: npm ERR! Linux 3.13.0-49-generic
2015-05-11T21:35:28.471022+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2015-05-11T21:35:28.458465+00:00 app[web.1]: npm ERR! not with npm itself.
2015-05-11T21:35:28.458841+00:00 app[web.1]: npm ERR! node ./bin/www
2015-05-11T21:35:28.471756+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2015-05-11T21:35:28.459009+00:00 app[web.1]: npm ERR! You can get their info via:
2015-05-11T21:35:28.459145+00:00 app[web.1]: npm ERR! npm owner ls showtrackr
2015-05-11T21:35:28.459299+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-05-11T21:35:29.488054+00:00 heroku[web.1]: State changed from starting to crashed
2015-05-11T21:35:29.489121+00:00 heroku[web.1]: State changed from crashed to starting
2015-05-11T21:35:29.467921+00:00 heroku[web.1]: Process exited with status 1
2015-05-11T21:35:33.804208+00:00 heroku[web.1]: Starting process with command `npm start`
2015-05-11T21:35:35.767544+00:00 app[web.1]: Recommending WEB_CONCURRENCY=1
2015-05-11T21:35:35.767452+00:00 app[web.1]: Detected 512 MB available memory, 512 MB limit per process (WEB_MEMORY)
2015-05-11T21:35:37.227415+00:00 app[web.1]: > node ./bin/www
If anyone can help with this, that would be awesome.
Don't know why but I ran
npm install
and repushed to heroku and everything worked.

Resources