Repository navigation
Error: read ECONNRESET - HTTP post request from Meteor to Node js server #10422
Description
Activity
Do you have a test case that uses only built-in modules? If yes, please post it. If not, you should close this and move to https://github.com/nodejs/help/issues or whatever the most appropriate bug tracker is (meteor, node-gcm, apn?). This bug tracker is only for reporting issues with node.js core.
@bnoordhuis Actually this is a nodejs issue. Because it gives ECONNRESET. It means Nodejs server is denying my requests sometimes. And about the node-gcm, apn I have tested them. they work fine on meteor server.
Okay, then please post a core modules-only test case. No one is going to take a look at it as long as it uses third-party modules. You should try to exclude meteor as well.
@bnoordhuis I am concerned with this piece of code on my nodejs server:
// All post requests app.post('/', function(req, res){ try { var response = JSON.parse(req.body.pushNotificationApiParams); var callType = req.body.callType; res.writeHead(200, {'Content-Type': 'text/html'}); switch (callType) { case 'systemPushNotifications': return pushNotificationClass.sendPushNotificationsV2(response); break; } res.end('thanks'); } catch(e){ realFs.appendFile('errorLogs/'+helperClass.getCurrentDateFormated()+'.log', helperClass.formatLog('Exception in main Post Method : '+e.stack) , function (err) { if (err) throw err; //console.log('The "data to append" was appended to file!'); }); } });As you see
res.writeHead(200, {'Content-Type': 'text/html'});&res.end('thanks');. I assume the are not writing and returning my response properly sometimes due to the async code running between- addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Dec 23, 2016 Closing for lack of reproduction. @MartiniHenry1988 If you still wish to pursue this, then please post a standalone test case.
- addedinvalidIssues and PRs that are invalid.Issues and PRs that are invalid.
on Jun 30, 2017
I am using a node server to handle all my push notifications services like GCM and APN.
I have 2 different servers. One is running the Meteor & another is running the Node Js to handle push notifications.
My main application is build on Meteor server.
I make an HTTP post request to nodejs server to send my notifications.
Usually it works fine, but sometimes on Meteor server I get this error whenever I call the nodejs server:
Error: read ECONNRESET at Object.Future.wait (/home/mbm/.meteor/packages/meteor-tool/.1.1.10.12ml1tp++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:398:15) at Object.call (packages/meteor/helpers.js:119:1) at Object.sendHttpCall (server/pushNotifications.js:249:1) at server/pushNotifications.js:244:1 at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1) at packages/meteor/timers.js:6:1 at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1) - - - - - at errnoException (net.js:905:11) at TCP.onread (net.js:559:19)Here is my Node Js server code:
And here is my code from Meteor side, where I am make HTTP post request to node js server:
Can anyone guide me in the right direction? Also I would really appreciate to know some good practices as well.