MeteorJS email configuration SSL - email

I am trying to send emails from Meteor JS and took the simplest approach found in the documentation. However, sending fails and I get the following stack trace:
Exception while invoking method 'sendEmail' Error: connect ETIMEDOUT
at Object.Future.wait (/usr/lib64/meteor/lib/node_modules/fibers/future.js:322:15)
at smtpSend (app/packages/email/email.js:69:43)
at Object.Email.send (app/packages/email/email.js:111:7)
at Meteor.methods.sendEmail (app/server/email.js:7:11)
at _.extend.protocol_handlers.method.exception (app/packages/livedata/livedata_server.js:593:30)
at _.extend.withValue (app/packages/meteor/dynamics_nodejs.js:33:19)
at app/packages/livedata/livedata_server.js:592:46
at _.extend.withValue (app/packages/meteor/dynamics_nodejs.js:33:19)
at _.extend.protocol_handlers.method (app/packages/livedata/livedata_server.js:591:37)
at _.extend.processMessage.processNext (app/packages/livedata/livedata_server.js:484:43)
- - - - -
at errnoException (net.js:770:11)
at Object.afterConnect [as oncomplete] (net.js:761:19)
I provide my email settings in bootstrap.js in the server folder via this line:
process.env.MAIL_URL = "smtp://user#gmail.com:password#smtp.googlemail.com:465"
I am pretty sure I also have to switch on SSL somewhere, but I do not know how (I could probably use Node's email.js alone).

Found it myself - it was not the lack of setting the SSL option, but the first '#gmail.com' in MAIL_URL. The correct line is:
process.env.MAIL_URL = "smtp://user:password#smtp.googlemail.com:465"

Related

SOAP API Automating testing with ROBOTFRAMEWORK

Good day,
I am trying to use robot framework to test a soap based api. I tried using the RobotFramework-Soap library first. I tried a sample case and it works but as soon as I put in my api link it does not work. Im not sure if it is because my api link contains an api.
N.B. due to confidentiality I am unable to post the actual api link. But it is in the format shown below.
*** Settings ***
Library SoapLibrary
Library OperatingSystem
*** Test Cases ***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
${response} Call SOAP Method With XML ${CURDIR}/request.xml
${text} Get Data From XML By Tag ${response} AddResult
Log To Console ${text}
Save XML To File ${response} ${CURDIR} response_test
When I run the above test. It fails with following error:
ConnectionError: HTTPConnectionPool(host='xxx_cert', port=8000): Max retries exceeded with url: /SomeService?xsd=xsd0 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
I even tried using the suds library as well. and when i do a simple test as follows:
***Test Cases***
Example
Create Soap Client http://000.000.000.000:8000/SomeService?wsdl
I get the following error: URLError: urlopen error [Errno 11001] getaddrinfo failed
I did some searching and I found that it could be related to the port. But Im not sure how to resolve this issue.
Any assistance would be greatly appreciated.
Thanks,
Lee
The solution was to edit the local host file to cater for the web service. That seemed to solve all the problems.

nodemon] app crashed - waiting for file changes before starting

I cannot connect to Mongo using mongoose ,,,
querySrv ENODATA _mongodb._tcp.todocluster-3kozc.mongodb.net
[nodemon] app crashed - waiting for file changes before starting...
I found a solution in another post Error: querySrv ENODATA _mongodb._tcp.blog-cluster-0hb5z.mongodb.net at QueryReqWrap.onresolve [as oncomplete]
For some reason the dns server did not return srv records, changing the dns server to one that returns those records fixed the problem. (I used https://use.opendns.com/ to fix the it)
it works now ...
npx kill-port 5000
then,
yarn start or npm start

Meteor.loginWithFacebook Suddenly Producing Intermittent Timeouts when authenticating

Currently running Meteor 1.5 Release using a bundle that is deployed on our linode server. All has been ok in the past, but now in production environment when attempting to authenticate using Meteor.loginWithFacebook we are getting intermittent connection timeouts when the oauth attempts to establish the connection with Facebook server. The FB App settings appear fine. As mentioned, the logins will work most of the time but its not consistent.
We are using the popup style auth login flow.
For example: You sign in/sign out with no problem. Then repeat the same process again and its fine, and then for example you try again and it can suddenly just get hung up with a popup window trying to establish the facebook authentication.
On the server console log you will get these type of messages:
{"line":"431","file":"oauth.js","message":"Error in OAuth Server: Failed to fetch identity from Facebook. connect ETIMEDOUT 31.13.77.6:443","time":{"$date":1505065274956},"level":"warn"}
{"line":"431","file":"oauth.js","message":"Error in OAuth Server: Failed to complete OAuth handshake with Facebook. connect ETIMEDOUT 31.13.77.6:443","time":{"$date":1505065292025},"level":"warn"}
Exception in onLogin callback: Error: connect ETIMEDOUT 31.13.77.6:443
at Object.Future.wait (/var/bd/site/bd/09_09_2017_22_32_30/bundle/programs/server/node_modules/fibers/future.js:449:15)
at Object.call (packages/meteor.js:213:24)
at Object.HTTP.get (packages/http/httpcall_common.js:50:20)
at server/auth.js:48:34
at runAndHandleExceptions (packages/callback-hook.js:152:24)
at packages/callback-hook.js:159:12
at packages/accounts-base/accounts_server.js:167:5
at [object Object]._.extend.each (packages/callback-hook.js:128:15)
at AccountsServer.Ap._successfulLogin (packages/accounts-base/accounts_server.js:166:21)
at AccountsServer.Ap._attemptLogin (packages/accounts-base/accounts_server.js:356:10)
at [object Object].methods.login (packages/accounts-base/accounts_server.js:533:21)
at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1737:12)
at packages/ddp-server/livedata_server.js:719:19
at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
at packages/ddp-server/livedata_server.js:717:40
at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
- - - - -
at Object.exports._errnoException (util.js:907:11)
at exports._exceptionWithHostPort (util.js:930:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
Please any help would be greatly appreciated. I cannot figure out why the timeout is occurring. It happens only sometimes.
Thank you!

Meteor accounts not working

Basic problem: logging into Meteor app isn't working and I don't know why.
I have a meteor app that uses the accounts-password package, but whenever I try to log in (whether it be with the accounts-ui dropdown or by calling Meteor.loginWithPassword), there is an "internal server error", as it shows on the accounts-ui dropdown.
I had the app working (I just was always logged in already), but I ran the meteor reset command to clear out the databases, and now it doesn't allow logging in. I even tried Meteor.loginWithToken, using the token I found in the mongo console for a user, but even that didn't work (still internal server error).
On the server, it shows a bunch of "MongoError" Exceptions, which are periodically emitted after trying to log in the first time. I tried using accounts-google instead, but same error occurs. This also happens when creating accounts, as it logs you in afterward (but it does create the account before crashing). Meanwhile, the client console shows no errors (just the "internal server error" in the page itself).
Here are the first error messages that show up on the server when logging in:
I20130821-10:55:59.266(-4)? Exception from task: MongoError: invalid query
I20130821-10:55:59.335(-4)? at Object.Future.wait (/Users/efriis/.meteor/tools/4010e5731d/lib/node_modules/fibers/future.js:326:15)
I20130821-10:55:59.336(-4)? at _.extend._nextObject (packages/mongo-livedata/mongo_driver.js:540)
I20130821-10:55:59.336(-4)? at _.extend.forEach (packages/mongo-livedata/mongo_driver.js:570)
I20130821-10:55:59.336(-4)? at _.extend.getRawObjects (packages/mongo-livedata/mongo_driver.js:621)
I20130821-10:55:59.336(-4)? at _.extend._pollMongo (packages/mongo-livedata/mongo_driver.js:897)
I20130821-10:55:59.336(-4)? at _.extend._addFirstObserveHandle (packages/mongo-livedata/mongo_driver.js:830)
I20130821-10:55:59.338(-4)? at Meteor.bindEnvironment.runWithEnvironment (packages/meteor/dynamics_nodejs.js:69)
I20130821-10:55:59.338(-4)? at Object.Meteor.bindEnvironment [as task] (packages/meteor/dynamics_nodejs.js:79)
I20130821-10:55:59.338(-4)? at _.extend._run (packages/meteor/fiber_helpers.js:144)
I20130821-10:55:59.338(-4)? at _.extend._scheduleRun (packages/meteor/fiber_helpers.js:122)
I20130821-10:55:59.338(-4)? - - - - -
I20130821-10:55:59.338(-4)? at Object.toError (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/utils.js:110:11)
I20130821-10:55:59.338(-4)? at Cursor.nextObject.self.queryRun (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:54)
I20130821-10:55:59.339(-4)? at Cursor.close (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:903:5)
I20130821-10:55:59.339(-4)? at Cursor.nextObject.commandHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:21)
I20130821-10:55:59.340(-4)? at Db._executeQueryCommand (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/db.js:1658:9)
I20130821-10:55:59.340(-4)? at Server.Base._callHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/base.js:378:41)
I20130821-10:55:59.340(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:468:18)
I20130821-10:55:59.340(-4)? at MongoReply.parseBody (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
I20130821-10:55:59.340(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:426:20)
I20130821-10:55:59.340(-4)? at EventEmitter.emit (events.js:96:17)
I20130821-10:55:59.341(-4)? Exception while invoking method 'login' MongoError: invalid query
I20130821-10:55:59.341(-4)? at Object.Future.wait (/Users/efriis/.meteor/tools/4010e5731d/lib/node_modules/fibers/future.js:326:15)
I20130821-10:55:59.341(-4)? at _.extend.runTask (packages/meteor/fiber_helpers.js:79)
I20130821-10:55:59.341(-4)? at _.extend._addFirstObserveHandle (packages/mongo-livedata/mongo_driver.js:829)
I20130821-10:55:59.342(-4)? at MongoConnection._observeChanges (packages/mongo-livedata/mongo_driver.js:688)
I20130821-10:55:59.342(-4)? at Cursor.observeChanges (packages/mongo-livedata/mongo_driver.js:480)
I20130821-10:55:59.342(-4)? at Function.Meteor.Collection._publishCursor (packages/mongo-livedata/collection.js:232)
I20130821-10:55:59.343(-4)? at Cursor._publishCursor (packages/mongo-livedata/mongo_driver.js:461)
I20130821-10:55:59.343(-4)? at _.extend._runHandler (packages/livedata/livedata_server.js:868)
I20130821-10:55:59.343(-4)? at _.extend._setUserId.self._dontStartNewUniversalSubs (packages/livedata/livedata_server.js:696)
I20130821-10:55:59.343(-4)? at Function._.each._.forEach (packages/underscore/underscore.js:87)
I20130821-10:55:59.343(-4)? - - - - -
I20130821-10:55:59.343(-4)? at Object.Future.wait (/Users/efriis/.meteor/tools/4010e5731d/lib/node_modules/fibers/future.js:326:15)
I20130821-10:55:59.344(-4)? at _.extend._nextObject (packages/mongo-livedata/mongo_driver.js:540)
I20130821-10:55:59.344(-4)? at _.extend.forEach (packages/mongo-livedata/mongo_driver.js:570)
I20130821-10:55:59.344(-4)? at _.extend.getRawObjects (packages/mongo-livedata/mongo_driver.js:621)
I20130821-10:55:59.345(-4)? at _.extend._pollMongo (packages/mongo-livedata/mongo_driver.js:897)
I20130821-10:55:59.345(-4)? at _.extend._addFirstObserveHandle (packages/mongo-livedata/mongo_driver.js:830)
I20130821-10:55:59.345(-4)? at Meteor.bindEnvironment.runWithEnvironment (packages/meteor/dynamics_nodejs.js:69)
I20130821-10:55:59.345(-4)? at Object.Meteor.bindEnvironment [as task] (packages/meteor/dynamics_nodejs.js:79)
I20130821-10:55:59.345(-4)? at _.extend._run (packages/meteor/fiber_helpers.js:144)
I20130821-10:55:59.346(-4)? at _.extend._scheduleRun (packages/meteor/fiber_helpers.js:122)
I20130821-10:55:59.346(-4)? - - - - -
I20130821-10:55:59.346(-4)? at Object.toError (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/utils.js:110:11)
I20130821-10:55:59.346(-4)? at Cursor.nextObject.self.queryRun (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:54)
I20130821-10:55:59.346(-4)? at Cursor.close (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:903:5)
I20130821-10:55:59.346(-4)? at Cursor.nextObject.commandHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/cursor.js:634:21)
I20130821-10:55:59.347(-4)? at Db._executeQueryCommand (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/db.js:1658:9)
I20130821-10:55:59.347(-4)? at Server.Base._callHandler (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/base.js:378:41)
I20130821-10:55:59.347(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:468:18)
I20130821-10:55:59.347(-4)? at MongoReply.parseBody (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
I20130821-10:55:59.347(-4)? at Server.connect.connectionPool.on.server._serverState (/Users/efriis/.meteor/packages/mongo-livedata/86ae77f282/npm/node_modules/mongodb/lib/mongodb/connection/server.js:426:20)
I20130821-10:55:59.348(-4)? at EventEmitter.emit (events.js:96:17)
I'm stumped. Any Ideas?
Simple problem, just didn't show up in the error console:
I was publishing a collection from server, and I used the $in operator incorrectly. I had two arrays in it, rather than just using the concat() method to join them. This solved the problem.
To find out which query caused such an error, you can put console.log(this.query) into any place of the QueryCommand.prototype.toBinary function in ~/.meteor/packages/mongo-livedata/0120179b5c/npm/node_modules/mongodb/lib/mongodb/commands/query_command.js. The number part of the path (0120179b5c) can be looked up in the original error message.
In the new console output, the query will appear right before the error message.
Happy debugging!

Error using SoapClient() in PHP

I'm trying to access WSDL(Web Service Definition Language) file using SoapClient() of PHP. I found that WSDL file is authenticated. I tried with passing credentials on an array by another parameter and active SSL on my server, still I'm getting an error.
Here is the code I'm using:
$client = new
SoapClient("https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl",array("trace"
=> "1","Username" => "username","Password" => "password"));
Here is the error I'm getting:
Warning:
SoapClient::SoapClient(https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl)
[soapclient.soapclient]: failed to open stream: Connection timed out
in PATH_TO_FILE on line 80
Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning
: failed to load external entity
"https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl"
in PATH_TO_FILE on line 80
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing
WSDL: Couldn't load from
'https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl'
: failed to load external entity
"https://webservices.chargepointportal.net:8081/coulomb_api_1.1.wsdl"
in PATH_TO_FILE:80 Stack trace: #0
/home2/wingstec/public_html/widget/API/index.php(80):
SoapClient->SoapClient('https://webserv...', Array) #1 {main} thrown
in PATH_TO_FILE on line 80
It seems that error says file not exist at the path we given but when we run that path directly on browser then we're getting that file
Can anyone help me to figure out what the exactly problem is?
First make sure you have the right to access website from your hosting account or server - check first if you can access a http webservice (without the s). If not, check if allow_url_fopen is set to true in php.ini.
Then, if you are trying to establish a https connection, you need a local certificate.
See if you can add one and instantiate your Soap object using something like
new SoapClient($wsdl, array('local_cert' => $pathToLocalCert));