-1

I am trying to integrate Zoho mail with Nodejs application using nodemailer. I am able to do so locally and mails getting sent. But when I tried to push the same code to Openshift, it is failing with error:

port 8080 is not available to deploy.

I tried different combinations to find out the reason for that and as soon as I removed var nodemailer = require('nodemailer');, the application gets deployed.

Dependency in package.json {"nodemailer": "^3.0.2"}

Anyone else faced similar issues?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](https://meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Apr 05 '17 at 08:52
  • The error is not about NodeMailer but about a double usage of the 8080 port on openshift. – throrin19 Apr 05 '17 at 08:53
  • that error might be generic, http://stackoverflow.com/questions/31511724/application-failed-to-start-port-8080-not-available – Kalana Demel Apr 05 '17 at 08:57
  • @Anurag Dwivedi what's node version ? – Kalana Demel Apr 05 '17 at 09:00
  • @KalanaDemel v6.9.2 in my local system and the default node version available in Openshift. – Anurag Dwivedi Apr 05 '17 at 09:28
  • @AnuragDwivedi how do you configure nodemailer with zoho? I'm trying to create a service mail but I still get auth errors 535 – Elmer Dantas Apr 16 '17 at 09:43
  • @ElmerDantas, you first need to create a application specific password key by enabling 2-factor authentication [link](https://www.zoho.com/mail/help/adminconsole/two-factor-authentication.html#alink5) var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ host: 'smtp.zoho.com', port: 465, secure: true, // use SSL auth: { user: 'support@laundrynerds.com' pass: } }); Use generated key as , instead of actual password. – Anurag Dwivedi Apr 17 '17 at 16:11
  • @KalanaDemel My current NodeJs version in Openshift is 0.10. Do you know if there is any way to upgrade it to version 6.0 (minimum supported version by nodemailer) without upgrading my account. Anyone else who already did this. [tag:node.js] [tag:openshift] [tag:nodemailer] – Anurag Dwivedi Apr 17 '17 at 16:23
  • @AnuragDwivedi thanks for answering but my problem was because my SMTP account is from europe so instead of `smtp.zoho.com` it was `smtp.zoho.eu` I did't find this on Zoho site and the `nodemailer` docs consider Zoho as 'Know Services' but do not take this into consideration. I just found out this looking my zoho's account details. – Elmer Dantas Apr 18 '17 at 07:46
  • actually zoho has this information on it's site, but only if the site opens according to your region (first time I've opened it was `.com`, I just open and they recognized as `.eu`) – Elmer Dantas Apr 18 '17 at 07:54

1 Answers1

0

Since we found the was that nodemailer minimum nodejs version being not met, updating the node version on openshift would resolve the issue, to update the version use rhc to connect to the vm and do the following changes,

Node.js

By default, the Node.js version is determined by querying semver.io/node/unstable.

A different URL can be specified either via NODE_VERSION_URL environment variable or by setting .openshift/NODE_VERSION_URL marker in your application repository. For instance, you'd get the latest 6.x.x (6.10.2 as of today) by putting this in NODE_VERSION_URL variable or .openshift/NODE_VERSION_URL marker:

https://semver.io/node/resolve/6

If you're using a non-default Node.js version and you're planning to scale the application across multiple gears, you must use the environment variable.

npm

By default, the npm version is determined by running npm view npm version.

A different npm version can be specified either via NPM_VERSION_URL environment variable or by setting .openshift/NPM_VERSION_URL marker in your application repository. For instance, you'd get the latest 3.x (3.10.10 as of today) by putting this in NPM_VERSION_URL variable or .openshift/NPM_VERSION_URL marker:

https://semver.io/npm/resolve/3
Kalana Demel
  • 3,220
  • 3
  • 21
  • 34