mailjet / mailjet-apiv3-go

[API v3] Official Mailjet API v3 Go wrapper
https://dev.mailjet.com
MIT License
85 stars 31 forks source link

Keep getting "connection reset by peer" error on Google cloud app engine #105

Open slash-dev opened 1 year ago

slash-dev commented 1 year ago

Hi,

I've been using the Mailjet API for years and had no problem but since a few weeks, I started experiencing some "connection reset by peer" errors:

Error getting https://api.mailjet.com/v3/send/message: Post "https://api.mailjet.com/v3/send/message": read tcp 169.254.8.1:36658->35.187.79.8:443: read: connection reset by peer

I'm using Google cloud app engine.

I found a similar issue but it was because they were creating the client way before sending the email. Here I create a new client each time I try to send an email.

Is this expected?

Best, Adrien

EmanuelU commented 1 year ago

We are having the exact same issue. As it is, we have to switch supplier because of this issue.

wojtasiq commented 1 year ago

We have the same issue in python library, retrying also doesn't help - Google cloud app engine.

EmanuelU commented 1 year ago

It’s because Mailjet is blocking the GCP dynamic IPs seemingly randomly

jhimy-michel commented 1 year ago

I am having the same problem, I will go for another supplier as well.

slash-dev commented 1 year ago

Discussed with Mailjet support. They said that it's because they block some abusive IPs from GCP address range. They recommend to set up static IP address (doc for app engine) which in my case defeats the whole purpose of using mailjet. If I set up a static IP address, I will use SMTP directly and add this IP to my SPF config.

neilswingler commented 9 months ago

I have a java app running in google app engine. I hit this issue running in Europe West 1 (if the region makes a difference). I added a request to check and log my public ip address and it looks like for the life of a given instance the outgoing ip address is constant so I was able to identify a handful of ip addresses that Mailjet support has now unblocked. Otherwise I was having to kill poisoned instances in the hope of getting a new instance with a usable external IPv4 address. Maybe IPv6 would solve this issue but the mailjet API does not offer an IPv6 address.

glumb commented 6 months ago

This is a severe topic, why do you block IPs and not API keys? We need urgent help. Our customers are not receiving important email notifications because of this.

jhimy-michel commented 6 months ago

How I fixed (actually is a workaround) :

If you know a better way to deal with this, please let me know.

slash-dev commented 6 months ago

If you have a server with a fixed IP, you could do the same and have your own SMTP server and then you don't need to pay for an external provider like mailjet. My main goal of using a service like Mailjet is to avoid having my own server to maintain.

glumb commented 6 months ago

Thanks @jhimy-michel for sharing. But I agree with @slash-dev , we use mailjet to send mails from our "serverless" infrastructure.

Our "fix" will be to switch to a different provider if no solution can be found in a timely manner.

glumb commented 5 months ago

For everyone wondering how to solve this. We just switched to another provider, had no issues since. 😀