[SOLVED] Cannot connect to Moralis MongoDB even after ip whitelist

I am trying to migrate my data to a self-hosted mongodb, but I cannot connect to the current database hosted by Moralis using the MongoDB IP provided in the admin interface.

I have tried via nodejs code created for the moralis self hosting video: https://github.com/IAmJaysWay/mongoDBmigartion

AND I also tried with MongoDB compass.

The errors are similar
MongoDB compass error

connection <monitor> to 159.223.161.245:56728 closed

NodeJS code error

MongoServerSelectionError: connection <monitor> to 159.223.161.245:56728 closed
    at Timeout._onTimeout (S:\Dropbox\QuarkStars\mongodb-migration\mongoDBmigartion\node_modules\mongodb\lib\sdam\topology.js:293:38)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  reason: TopologyDescription {
    type: 'Unknown',
    servers: Map(1) { '159.223.161.245:56728' => [ServerDescription] },
    stale: false,
    compatible: true,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    setName: null,
    maxElectionId: null,
    maxSetVersion: null,
    commonWireVersion: 0,
    logicalSessionTimeoutMinutes: null
  },
  code: undefined,
  [Symbol(errorLabels)]: Set(0) {}

I have tried:

  • Whitelisted all my ipv4 address including DNS addresses on the admin interface and pressed save config
  • Switching to useUnifiedTopology:false

The error is the same.

you have to whitelist you public IP address, you can search on google โ€œwhat is my IP addressโ€ and that is the IP address that you should whitelist

1 Like

My public IP has colons and is not accepted by the admin interface as a valid address (ipv6?)

you donโ€™t also have an IPv4 IP?

1 Like

Oh there we go! Fixed.

My wifi properties my IPv4 address was different from the one I got from https://whatismyipaddress.com/

The one I get from my wifi properties did not work.

1 Like