I have an express server running on a docker container, and using nginx for reverse proxy and https.
Dockerfile
FROM node:alpine as BUILD_IMAGE
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
EXPOSE 5000
CMD ["yarn", "start"]
docker-compose.yml
api_server:
container_name: api-server
restart: always
build: ./server-api/
ports:
- '5000:5000'
depends_on:
- postgres
- redis
- url_server
- og_server
I am using nodemailer sendgrid to send emails and also using mailchimp but both are not working.
This is the logs:
mailchimp err Error: Timeout of 120000ms exceeded
at RequestBase._timeoutError (/**/**/app/node_modules/superagent/lib/request-base.js:613:13)
at Timeout.<anonymous> (/**/**/app/node_modules/superagent/lib/request-base.js:628:12)
at listOnTimeout (node:internal/timers:556:17)
at processTimers (node:internal/timers:499:7) {
timeout: 120000,
code: 'ECONNABORTED',
errno: 'ETIME',
response: undefined
}
Fail to send email {
err: Error: connect ETIMEDOUT 3.64.200.27:443
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1139:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:131:14) {
errno: -110,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '3.64.200.27',
port: 443
}
}
This is my ufw status:
To Action From
-- ------ ----
22/tcp LIMIT Anywhere
2375/tcp ALLOW Anywhere
2376/tcp ALLOW Anywhere
Nginx Full ALLOW Anywhere
465 ALLOW Anywhere
25 ALLOW Anywhere
587 ALLOW Anywhere
22/tcp (v6) LIMIT Anywhere (v6)
2375/tcp (v6) ALLOW Anywhere (v6)
2376/tcp (v6) ALLOW Anywhere (v6)
Nginx Full (v6) ALLOW Anywhere (v6)
465 (v6) ALLOW Anywhere (v6)
25 (v6) ALLOW Anywhere (v6)
587 (v6) ALLOW Anywhere (v6)
I tried to run the container on my local machine (windows 10) and everything works fine email was sent and mailchimp works too, but on DO droplet it didn’t work.
Any ideas? thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
I found the issue it’s the iptables
sudo nano /etc/docker/daemon.json
{ "iptables": false }
I change it to true
{ "iptables": true}
sudo service docker restart
It was me who alter the iptables to false because I was trying to prevent Docker from bypassing UFW and directly alters iptables.
Now it’s working
Hi @larbisahli1905,
By default for new accounts, port 25 is closed. I would recommend trying with port 587 instead.
To test if port 587 is open you can run the following command:
telnet Your-IP-Address 587
If port 587 is blocked as well, I’ll recommend contacting DigitalOcean’s support to see if the port can be lifted.
You can reach the support at :
Hope that helps! - KFSys.
Hi there,
As far as I can see from the error, the outgoing connection on port 443 is failing.
I would recommend allowing that port via UFW as well as it is currently not in the list that you’ve provided.
Let me know how it goes. Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.