I have a site running in production. The backend connects to mongo atlas cloud.
Error: connect ECONNREFUSED 52.202.136.90:27017
caused an unhandled rejection. What does this error mean?
I found reports of a similar error, but for those reports the error prevented connection to mongo entirely. On the other hand, my backend was already running in production and had been making connections to my mongo atlas cloud database before I got this error. I have a lot of activity on my site, yet this only happened with one request.
Heroku uses a range of AWS IP addresses. So I have 0.0.0.0/0 (includes your current IP address) in my IP Access list for Network Access to account for their changing IP’s.
I’m not sure what’s causing this which also means I’m not sure where to look to add some error handling or what this concerns.
Backend logs
Jul 02 15:24:25 myapp app/web.1 2022-07-02T20:24:25.105Z silly: OPTIONS: /api/posts/62c0a45ad56ea20004014196
Jul 02 15:24:25 myapp app/web.1 2022-07-02T20:24:25.197Z silly: PATCH: /api/posts/62c0a45ad56ea20004014196
Jul 02 15:24:25 myapp app/web.1 allowedOrigin https://www.mysite.com
Jul 02 15:24:25 myapp app/web.1 node:internal/process/promises:279
Jul 02 15:24:25 myapp app/web.1 triggerUncaughtException(err, true /* fromPromise */);
Jul 02 15:24:25 myapp app/web.1 ^
Jul 02 15:24:25 myapp app/web.1 Error: connect ECONNREFUSED 52.202.136.90:27017
Jul 02 15:24:25 myapp app/web.1 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16) {
Jul 02 15:24:25 myapp app/web.1 name: 'MongoNetworkError'
Jul 02 15:24:25 myapp app/web.1 }
Jul 02 15:24:25 myapp heroku/web.1 State changed from up to crashed
Jul 02 15:24:25 myapp heroku/web.1 State changed from crashed to starting
Jul 02 15:24:25 myapp heroku/router at=error code=H13 desc="Connection closed without response" method=PATCH path="/api/posts/62c0a45ad56ea20004014196" host=api.mysite.com request_id=f2f05673-f516-49d1-b2c4-e07f33b5bc8a fwd="45.49.3.242" dyno=web.1 connect=0ms service=38ms status=503 bytes=0 protocol=https