Vapor 4 with Azure CosmosDB

I'm trying to use Vapor 4 to connect to Azure CosmosDB via the MongoDB interface, but I'm not able to connect. I followed the instructions in Microsoft's document (links below)

I'm able to connect via the command-line using the provided connection URI, and using other technologies (NodeJS and Python), but I can't connect using Vapor. Is there some setting that I'm mssing that could make this work?

The URI I'm using looks like:
mongodb://vaportest:password@vaportest.mongo.cosmos.azure.com:10255/vapor?ssl=true

The password looks like a hashed value -- it always ends with "=="

The error I'm seeing is:

[ ERROR ] Couldn't find or create a connection to MongoDB with the requested specification
[ ERROR ] No hosts could be connected with, therefore no queries can be sent at the moment: The connection string could not be used to connect to a host
Solution(s):
- Check if your hosts are online, not undergoing maintenance
- Check your connection strings for any errors in configuration
- Check if your server is whitelisted when using MongoDB atlas
- If using MongoDB atlas, make sure you're connecting with SRV

Terms of Service

Privacy Policy

Cookie Policy