Closed nikophil closed 2 years ago
@nikophil are you sure this is because of ODM and not some other library/driver update? Asking because authSource
is not used anywhere in the ODM: https://github.com/doctrine/mongodb-odm/search?q=authSource
Hi @malarzm
I'm a sure: I looked for the culprit by dichotomy and found doctrine/mongo-odm:2.3.0
:
$ composer info doctrine/mongodb-odm
# results in 2.2.3
$ bin/console doctrine:mongodb:schema:update
Updated indexes for all classes
$ composer u doctrine/mongodb-odm:2.3.0
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
- Upgrading doctrine/mongodb-odm (2.2.3 => 2.3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Downloading doctrine/mongodb-odm (2.3.0)
- Upgrading doctrine/mongodb-odm (2.2.3 => 2.3.0): Extracting archive
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
Executing script cache:clear [OK]
$ bin/console doctrine:mongodb:schema:update
Updated indexes for all classes
not authorized on db to execute command { collMod: "some-collection", validator: [], validationAction: "error", validationLevel: "strict", $db: "db", lsid: { id: UUID("xxxxxxxxxxx") }, $clusterTime: { clusterTime: Timestamp(1640850344, 139), signature: { hash: BinData(0, xxxxxxxx), keyId: xxxxxxxx } } }
maybe, I'm mistaking and the root cause is not authSource
parameter, but the error only occurs on a database with authentication database has a name different than admin
.
BTW here some extra info: php: 8.0.12 mongo-ext: 1.10.0 mongodb/mongodb: 1.9.0 symfony/ : 5.4. doctrine/mongodb-odm-bundle: 4.3.1
not authorized on db to execute command { collMod: "some-collection", validator: [], validationAction: "error", validationLevel: "strict", $db: "db", lsid: { id: UUID("xxxxxxxxxxx") }, $clusterTime: { clusterTime: Timestamp(1640850344, 139), signature: { hash: BinData(0, xxxxxxxx), keyId: xxxxxxxx } } }
This query comes from new feature in ODM 2.3 (https://github.com/doctrine/mongodb-odm/pull/2238). Most probably the user you're authenticating with is not authorized to run collMod
commands
thanks for this, I'll ask for a change of the authorization o my user, I'll let you know.
sorry for the misunderstanding about authsource
Hello,
BC Break Report
Summary
Since we've upgraded to doctrine/mongo-odm 2.3.0 the
authSource
will always beadmin
even if another one is provided in the dsn with theauthSource
param. This leads to "authentication failed" errors.How to reproduce
try to connect to a database which authentication database has another name than
admin
thanks for your work :+1: