bun icon indicating copy to clipboard operation
bun copied to clipboard

VPN - express can't connect to "MongoDB Atlas cluster"

Open birkskyum opened this issue 1 year ago • 4 comments

What version of Bun is running?

1.1.9-canary.1+4df387d59

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

make a mongodb connection

What is the expected behavior?

This issue where the backend can't connect to mongo when a VPN is active isn't happened in node

What do you see instead?

I see:

│ GET /myuser [STARTED]
│ 870 |  */
│ 871 | 
│ 872 | function _handleConnectionErrors(err) {
│ 873 |   if (err?.name === 'MongoServerSelectionError') {
│ 874 |     const originalError = err;
│ 875 |     err = new ServerSelectionError();
│                                       ^
│ MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from a…
│  code: "undefined"
│       at new MongooseError (:1:33)
│       at new MongooseServerSelectionError (:1:33)
│       at _handleConnectionErrors (/Users/admin/repos/project/node_modules/.pnpm/[email protected]/node_modules/mongoose/lib/connection.js:875:11)
│       at /Users/admin/repos/project/node_modules/.pnpm/[email protected]/node_modules/mongoose/lib/connection.js:826:11
│ Bun v1.1.9-canary.1+4df387d59 (macOS arm64)

Additional information

"mongoose": "^8.3.4", "express": "^4.19.2",

VPN: Proton VPN

birkskyum avatar May 21 '24 12:05 birkskyum

This is probably fixed by https://github.com/oven-sh/bun/pull/11206, which just got merged. Could you upgrade canary and try again?

Electroid avatar May 21 '24 16:05 Electroid

Same with 1.1.9-canary.1+396dc7852

Update: still on 1.1.17+bb66bba1b

birkskyum avatar May 21 '24 19:05 birkskyum

@birkskyum can you try in #11235

bunx bun-pr jarred/web-scale

Then

bun-11235 <script

Jarred-Sumner avatar May 21 '24 20:05 Jarred-Sumner

It didn't do the trick unfortunately

birkskyum avatar May 21 '24 21:05 birkskyum

This is still an issue in 1.1.23 - noticed some tls fixes, but they didn't do the trick.

birkskyum avatar Aug 14 '24 01:08 birkskyum

sad

Jarred-Sumner avatar Aug 14 '24 01:08 Jarred-Sumner

Maybe internally it's uses duplex upgrade to TLS

cirospaciari avatar Aug 14 '24 01:08 cirospaciari

@birkskyum Proton VPN blocks 27017 port thats why you aren't able to connect. I think there is a option to bypass VPN for certain url / hostnames (in paid version) that can help otherwise try w/o using VPN or some other VPN.

faisalferoz avatar Sep 18 '24 11:09 faisalferoz

Thanks for looking into this @faisalferoz ! It is the paid version. As shown here, there doesn't appear to be anywhere to whitelist specific urls/hostnames, but it's great to know it's the 27017 port block that cause this, and that it's potentially Proton VPN specific.

(I've tried the "Don't block" here too, and it doesn't help) Screenshot 2024-09-18 at 13 11 19 Screenshot 2024-09-18 at 13 09 17 Screenshot 2024-09-18 at 13 09 13 Screenshot 2024-09-18 at 13 09 10

birkskyum avatar Sep 18 '24 11:09 birkskyum

Closing - since it's not specific to bun

birkskyum avatar Sep 18 '24 11:09 birkskyum

Thanks for looking into this @faisalferoz ! It is the paid version. As shown here, there doesn't appear to be anywhere to whitelist specific urls/hostnames, but it's great to know it's the 27017 port block that cause this, and that it's potentially Proton VPN specific.

@birkskyum Its called Split Tunneling in Proton VPN - heres a link for details https://protonvpn.com/support/protonvpn-split-tunneling/

faisalferoz avatar Sep 18 '24 11:09 faisalferoz

@faisalferoz - reason I couldn't find it is that it's a Windows/Android only feature for now, but hopefully will come to macos eventually, so I'll use another solution until then. Thanks!

birkskyum avatar Sep 18 '24 11:09 birkskyum