MongoDB ERROR: Text record must only set `authSource` or `replicaSet` (n8n.cloud)

Hi guys,
I’m trying to configure the MongoDB node with Connection String (i.e. mongodb+srv://sample-user:[email protected]/sample-database) on my n8n.cloud account.

I’m getting this error code when trying to connect:
ERROR: Text record must only set authSource or replicaSet

I already tried:

  • Whitelisting N8N cloud IP (I just set MongoDB to accept all IPs for testing)
  • Configuring with the node with Values instead, no luck with this either

Do you have any pointers for me?

Hi @jonas, I am sorry to hear you’re encountering this behaviour. I quickly tested this using a database from https://cloud.mongodb.com but did not run into any trouble here using a Connection String:

Queries are working fine on n8n cloud:

So I suspect the issue is not with using connection strings but with connecting to “serverless” instances similar to the error described here. As per the linked post, support for these was only added recently to the MongoDB Node.js driver.

So I think we’d need to bump the version of the Node.js driver for MongoDB we have in use. I will add this to our bug tracker and we’ll confirm once this has been done.

Please accept my sincere apologies for the inconvenience this causes.

Hi @jonas, to follow up on this and to unblock you, you might want to consider using the Data API through the HTTP Request node. This would not require a specific driver, so should also work for serverless instances.