Closed sereisoglu closed 1 month ago
@sereisoglu Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
Thanks @sereisoglu, I'll follow up on this one to see if we can land a PR by the end of the week. cc @eashaw
Hello, I’m here to shed some light on the issue.
Compatibility with the +srv protocol was added years ago; I included it myself in a PR years back.
The problem is with the appName
parameter, which needs to be added in the constants file.
Notice that the appname
element already exists in the array, but appName
in camelCase is missing and needs to be added at the end of the array.
Personally, I wouldn’t delete the lowercase appname
because, even though I believe it’s a mistake since it’s never used in lowercase in the connection URL, it is still a variable that exists as an option in the drivers.
I hope it helps.
Hey @Josebaseba this is very useful and with what you explained I think it will help land a fix for this sooner than I expect. I will submit a patch. In the spirit of making the smallest change to land this, I will add the appName
and test if it fixes it then maybe in a separate PR see to remove appname
.
Hey @sereisoglu thanks to @Josebaseba we've discovered this is a whitelist config options issue and I have made a PR to add the appName
config option.
Hey @Josebaseba, @DominusKelvin, as I mentioned above, appName is available in both srv and non-srv urls, but since it only caused problems in srv urls, I thought the problem was that srv support was not available. Thanks for your comment, that was very informative @Josebaseba. Thanks for your PR and support @DominusKelvin.
Sure thing @sereisoglu!
Node version: Sails version (sails): 1.5.11 ORM hook version (sails-hook-orm): Sockets hook version (sails-hook-sockets): Organics hook version (sails-hook-organics): Grunt hook version (sails-hook-grunt): Uploads hook version (sails-hook-uploads): DB adapter & version (e.g. sails-mysql@5.55.5): sails-mongo 2.1.1 Skipper adapter & version (e.g. skipper-s3@5.55.5): MongoDB version: 6.0
Hello, there is no srv support in the connection url for sails-mongo.
I shared the error message above. It says there is a problem with appName, but appName is found in the connection url with and without srv. It gives this error only for connection url with srv.
Connection url formats: without srv: (this works with sails-mongo)
mongodb://admin:<password>@clusterName-shard-00-00.xxxxx.mongodb.net:27017,clusterName-shard-00-01.xxxxx.mongodb.net:27017,clusterName-shard-00-02.xxxxx.mongodb.net:27017/database?ssl=true&replicaSet=atlas-xxxxxx-shard-0&authSource=admin&retryWrites=true&w=majority&appName=clusterName
with srv: (this does not work with sails-mongo)
mongodb+srv://admin:<password>@clusterName.xxxxx.mongodb.net/database?retryWrites=true&w=majority&appName=clusterName