mailjet-apiv3-nodejs icon indicating copy to clipboard operation
mailjet-apiv3-nodejs copied to clipboard

Unsuccessful: null read ECONNRESET

Open gdeichen opened this issue 2 years ago • 20 comments

I get this error consistently on one Ubuntu Server installation, even though it works on several others. Any idea how I can debug it? Thanks.

Unsuccessful: null read ECONNRESET

gdeichen avatar Sep 30 '21 22:09 gdeichen

This is the response to a simple mailjet post / request, basically the same as this: https://github.com/mailjet/mailjet-apiv3-nodejs#simple-post-request

gdeichen avatar Oct 01 '21 09:10 gdeichen

We are getting the same error as well

bhavelyn avatar Nov 03 '21 23:11 bhavelyn

Same error here. We have this issue when running on AWS Lambda, but everything works fine locally or from a docker container running... Any clue on how to debug/solve this ?

cc @andrii-yelis maybe ? 😅

adrienthiery avatar Nov 08 '21 16:11 adrienthiery

Same here, it suddenly stopped working... is there a rate limit or something we are not aware of ?

LouisLec avatar Nov 18 '21 10:11 LouisLec

It's not a rate limit problem; there is a (silent!) limit of 200/day for the free tier, but the emails go through to the queue without an error.

I got around this by building a new VM from scratch. So it's some kind of library conflict or whatever, but there's nothing in any logs that give me a clue to what the issue is.

gdeichen avatar Nov 18 '21 11:11 gdeichen

For us, it "started working again" next day, or at least started giving us a "real error", being that we did not initialize the SDK correctly 🤷

Not sure if it was because of that or something else

adrienthiery avatar Nov 18 '21 13:11 adrienthiery

Thx @gdeichen,

there is a (silent!) limit of 200/day for the free tier

I'm not on the free tier and was far from 200 that day 😢

Anyway it's working again so there must be a limit somewhere...

LouisLec avatar Nov 19 '21 09:11 LouisLec

I have also just had this issue. No emails are sending at all at the moment. I'm on the free tier but have not sent an email for days.

Any idea whats causing it? The full error im seeing is:

Error: Unsuccessful: null read ECONNRESET
    at /root/service-backend/node_modules/node-mailjet/mailjet-client.js:331:23
    at Request.callback (/root/service-backend/node_modules/superagent/lib/node/index.js:905:3)
    at ClientRequest.<anonymous> (/root/service-backend/node_modules/superagent/lib/node/index.js:822:12)
    at ClientRequest.emit (node:events:394:28)
    at ClientRequest.emit (node:domain:470:12)
    at TLSSocket.socketErrorListener (node:_http_client:447:9)
    at TLSSocket.emit (node:events:394:28)
    at TLSSocket.emit (node:domain:470:12)
    at emitErrorNT (node:internal/streams/destroy:193:8)
    at emitErrorCloseNT (node:internal/streams/destroy:158:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  ErrorMessage: 'read ECONNRESET',
  ErrorIdentifier: undefined,
  statusCode: null,
  response: null
}

EDIT: about 2 minutes after posting this, and continually trying to send emails, it started working again. Its almost like some service was spinning up to send emails for my account. Very strange.

alex-r89 avatar Nov 27 '21 23:11 alex-r89

Having the same problem here with the post API. It stopped working about a week ago, I'm using the same keys in staging and production, oddly, the production mails are working properly but staging doesn't seem to send anything. EDIT: 4 Hours after posting, emails suddenly work again

CardonaPablo avatar Dec 23 '21 19:12 CardonaPablo

This sounds like the Mailjet API is having some issues right now? We have seen this errors from time to time as well, this seems to happen infrequently, but still it is not reliable.

boldtrn avatar Jan 05 '22 07:01 boldtrn

Im having the same issue, we are using the Mailjet API in some gcp cloud functions and it was working before for along 2 years, and not it is sending few mails but not all. We are seeing the same ECONRESET message :/

Any idea on how can we solve the issue? some kind of rate limit issue? we are not using the free tier btw

roger1345 avatar Jan 10 '22 00:01 roger1345

Experiencing the exact same issue. We use also GCP Cloud Functions.

Error: Unsuccessful: null read ECONNRESET
    at /workspace/node_modules/node-mailjet/mailjet-client.js:331:23
    at Request.callback (/workspace/node_modules/superagent/lib/node/index.js:905:3)
    at ClientRequest.<anonymous> (/workspace/node_modules/superagent/lib/node/index.js:822:12)
    at ClientRequest.emit (events.js:400:28)
    at ClientRequest.emit (domain.js:475:12)
    at TLSSocket.socketErrorListener (_http_client.js:475:9)
    at TLSSocket.emit (events.js:400:28)
    at TLSSocket.emit (domain.js:475:12)
    at emitErrorNT (internal/streams/destroy.js:106:8)
    at emitErrorCloseNT (internal/streams/destroy.js:74:3)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  ErrorMessage: 'read ECONNRESET',
  ErrorIdentifier: undefined,
  statusCode: null,
  response: null
}

danielluca avatar Jan 20 '22 07:01 danielluca

We are facing the exact same issue. We also use Firebase GCP Function from Frankfurt.

Sometimes we are able to call the function. I think there are some IPs blocked from the range? Overall it is a big problem, because just in the last hour more than 500 mails were not send out. Is there a solution?

Error: Unsuccessful: null read ECONNRESET
    at /workspace/node_modules/node-mailjet/mailjet-client.js:331:23
    at Request.callback (/workspace/node_modules/superagent/lib/node/index.js:905:3)
    at ClientRequest.<anonymous> (/workspace/node_modules/superagent/lib/node/index.js:822:12)
    at ClientRequest.emit (events.js:314:20)
    at ClientRequest.EventEmitter.emit (domain.js:483:12)
    at TLSSocket.socketErrorListener (_http_client.js:427:9)
    at TLSSocket.emit (events.js:314:20)
    at TLSSocket.EventEmitter.emit (domain.js:483:12)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  ErrorMessage: 'read ECONNRESET',
  ErrorIdentifier: undefined,
  statusCode: null,
  response: null
} 

jona7o avatar Jan 31 '22 09:01 jona7o

Yes, that's exactly the same issue we are facing. Several mails are not send because of this. As far as we know today, Cloud Functions are using IP ranges and some of them are blocked by Mailjet.

Seems like the only solution is to use a static outbound IP address which should be used by the cloud function. We are still researching how we can provide our cloud functions with a static IP in GCP.

@jona7o

danielluca avatar Jan 31 '22 09:01 danielluca

@danielluca Unfortunately the mailjet support team can not help with this problem. Right now we are building a sendgrid fallback for the given error. If sendgrid works fine, we'll switch away the complete workload. I don't think it's getting solved in the near future. Hopefully we get a better customer service on paid plans. ;-)

jona7o avatar Jan 31 '22 13:01 jona7o

@jona7o we switched to Sendgrid due to that issue about 3 weeks ago and haven't seen any issues anymore. We are also using GCP cloud functions from Frankfurt.

boldtrn avatar Jan 31 '22 14:01 boldtrn

Doesn't that cause problems with the GDPR? Maybe this is also an alternative for us 🤔

@boldtrn @jona7o

danielluca avatar Jan 31 '22 14:01 danielluca

For those who are interested, we are now using a static ip in our cloud functions. Did not solve every problem but it helped to reduce them a lot. We got this link from the firebase support which describes really well, how to setup and use static ip's: https://medium.com/@scorpion.nimit/how-to-create-a-firebase-cloud-function-with-static-outbound-ip-8086bbbdbbfe

danielluca avatar Feb 05 '22 17:02 danielluca

Hello! we are doing the same @danielluca. Using a vpc connector in our cloud functions to use an static ip address. So far we are not seeing any ECONRESET error (in the last 2 days). We are keeping an eye on the logs.

roger1345 avatar Feb 07 '22 22:02 roger1345

@roger1345 👍 This approach fixed the issue for us. No more ECONNRESET Errors.

danielluca avatar Feb 10 '22 15:02 danielluca

Hello @gdeichen, did you try to use a static IP address as suggested above? Did it solve your problem?

ai-wintermute avatar Dec 08 '22 13:12 ai-wintermute

The server had a static IP. I ended up wiping it and starting from scratch. I haven't had the problem since.

gdeichen avatar Dec 08 '22 20:12 gdeichen

@gdeichen thank you for the quick response. I'm closing the issue then.

ai-wintermute avatar Dec 09 '22 08:12 ai-wintermute

For those who are interested, we are now using a static ip in our cloud functions. Did not solve every problem but it helped to reduce them a lot. We got this link from the firebase support which describes really well, how to setup and use static ip's: https://medium.com/@scorpion.nimit/how-to-create-a-firebase-cloud-function-with-static-outbound-ip-8086bbbdbbfe

We encountered the same problem today and after several hours of research @danielluca's suggestion resolved the issue for us.

donalffons avatar Dec 12 '22 18:12 donalffons

This just started happening to us seemingly out of nowhere (using firebase functions)

afpatmin avatar Jun 20 '23 15:06 afpatmin

Same here

AymericLegros avatar Jun 22 '23 09:06 AymericLegros

For the past few weeks the same error occurs many times a day. The sdk runs on firebase function, running on the europe-west1 region.

fj-vp avatar Jun 29 '23 07:06 fj-vp

Same issue randomly since June 7th. No changes on my side. Using Node.js on AppEngine of Google Cloud Platform.

fbuland avatar Jul 04 '23 09:07 fbuland

Also getting this now, and also running on europe-west1.

zakton5 avatar Jul 13 '23 15:07 zakton5

The issue is NOT from the library.

Maijet Support explanations :

Having in mind that you are using GCP, the issue most probably boils down to a blocked IP. The only reason why we would be blocking an IP address attempting to connect to our servers would be that too many unauthenticated requests were made from said IP via SMTP or HTTP. With a platform such as GCP, it is not unlikely that you have started being assigned IPs that had previously been used by other users on that platform, the actions of whom resulted in such unauthenticated calls.

Unfortunately, I can only check if a given IP is being blocked or not if I know its exact value (I cannot run this kind of check based on IP-ranges and on top of that, GCP utilizes hundreds of thousands of IPs, so checking each one is not a manageable task). I would recommend obtaining a TCP/IP capture in PCAP, that is recorded on the network level responsible for the request made to our server (as that way it would contain the public IP from which the call is being made)

fbuland avatar Jul 15 '23 10:07 fbuland