vscode icon indicating copy to clipboard operation
vscode copied to clipboard

VS code extension is not connecting to mongodb and localhost address is not working

Open Irfan-Haider05-spec opened this issue 11 months ago • 9 comments

Bug Report

Current Behavior

Code/Gist

Expected Behavior/Code

Environment

  • node.js / npm versions:
  • OS:

Possible Solution

Additional Context/Screenshots

Irfan-Haider05-spec avatar Jan 02 '25 17:01 Irfan-Haider05-spec

Can you elaborate on what is the problem you're experiencing and what you have tried already?

nirinchev avatar Jan 02 '25 17:01 nirinchev

I am also experiencing issues using the mongodb extension in VS code. A couple months ago I had no issues in VS code. Now, coming back to it almost any query operation fails with a VS code internal error. Using the mongosh shell with the same connection string is blazing fast. I have uninstalled and reinstalled the mongodb extension. Added and removed the connection. Some operations in the playground will go through, but that's 1 out of 10, attempting to run the same operation.

These are simple operations for troubleshooting the extension. Like db.collection.findOne and still failing to run in VS code, but Compass and Mongosh are perfect. The collection can also be browsed via the mongodb extension connection tree view. The issue is solely with executing any operations in the playground.

VS code error: "An internal error has occurred. The playground services have been restored. This can occur when the playground runner runs out of memory."

MongoDB extension uncaught error report: "Request ACTIVE_CONNECTION_CHANGED failed with message: Server record does not share hostname with parent URI"

Output log: "[info] Error [MongoAPIError]: Server record does not share hostname with parent URI at t.checkParentDomainMatch"

NexusUnleashed avatar Jan 03 '25 02:01 NexusUnleashed

The error you're getting ("Server record does not share hostname with parent URI") is most likely related to a DNS issue - are you connecting to Atlas or a local mongodb instance? Do you happen to have any proxies configured either at the machine or vscode level?

nirinchev avatar Jan 03 '25 07:01 nirinchev

I am also experiencing a similar problem with the mongodb extension with VS code. It's able to connect when I downgrade the extension to version 1.9.x, but VS code (v1.96.3) does not supply a button to execute the query from the playground.

my mongodb version is 3.6.12, and this latest version of the extension seems to no longer support.

Server reports maximum wire version 6, but this version of the Node.js Driver requires at least 7 (MongoDB 4.0)

I think I need to downgrade VS code.

image

jesegal avatar Jan 15 '25 13:01 jesegal

Unable to load connection: MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017, connect ECONNREFUSED ::1:27017

Anyone know how to fix this issue. localhost:27017 is unable to connect

TbrandSpace avatar Feb 18 '25 23:02 TbrandSpace

@TbrandSpace this error likely means mongod is not running.

nirinchev avatar Feb 21 '25 13:02 nirinchev

I am also getting this error Unable to connect: connect ECONNREFUSED 127.0.0.1:27017, connect ECONNREFUSED ::1:27017 How to fix it?

s-a-b-y-a avatar Mar 15 '25 08:03 s-a-b-y-a

Can you confirm that mongod is running? Can you connect using the MongoDB Shell or another tool?

nirinchev avatar Mar 17 '25 10:03 nirinchev

Unable to connect: querySrv ETIMEOUT _mongodb._tcp.cluster0.znzmh.mongodb.net when using mongodb VScode. the cluster is operational, was paused before but now active and yet, couldnt connect

kutib avatar Apr 13 '25 20:04 kutib