bun
bun copied to clipboard
VPN - express can't connect to "MongoDB Atlas cluster"
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
This is probably fixed by https://github.com/oven-sh/bun/pull/11206, which just got merged. Could you upgrade canary and try again?
Same with 1.1.9-canary.1+396dc7852
Update: still on 1.1.17+bb66bba1b
@birkskyum can you try in #11235
bunx bun-pr jarred/web-scale
Then
bun-11235 <script
It didn't do the trick unfortunately
This is still an issue in 1.1.23 - noticed some tls fixes, but they didn't do the trick.
sad
Maybe internally it's uses duplex upgrade to TLS
@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.
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)
Closing - since it's not specific to bun
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 - 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!