Skip to content

Document DB IAM Auth doesn't work with @payloadcms/db-mongodb - Mongoose Upgrade Required #12708

Closed
@FinnIckler

Description

@FinnIckler

Describe the Bug

"@payloadcms/db-mongodb" currently pins "mongoose": "8.9.5" which pins "mongodb": "~6.12.0", IAM Authentication only works from Version 6.13 as per https://docs.aws.amazon.com/documentdb/latest/developerguide/iam-identity-auth.html#iam-identity-drivers

Solution: Update Mongoose to the latest version

Link to the code that reproduces this issue

https://github.com/thewca/worldcubeassociation.org/pull/11716/files#diff-636eb4e387c2f51f264623909ff6a0599929f4618137c146666770f32b56b0ecR24

Reproduction Steps

  1. Follow a guide like this https://github.com/aws-samples/amazon-documentdb-samples/tree/master/samples/iam_role_sample_code to add the needed AWS Infrastructure
  2. try to authenticate to DocumentDB using the mongooseAdapter like
return mongooseAdapter({
      url: <<DOCUMENT_DB_URI>>,
        authMechanism: "MONGODB-AWS",
        authSource: "$external",
      },
    });
  1. Get Authentication failed message

Which area(s) are affected? (Select all that apply)

db-mongodb

Environment Info

Binaries:
  Node: 22.8.0
  npm: 10.8.2
  Yarn: 4.9.1
  pnpm: N/A
Relevant Packages:
  payload: 3.40.0
  next: 15.3.3
  @payloadcms/db-mongodb: 3.40.0
  @payloadcms/graphql: 3.40.0
  @payloadcms/live-preview: 3.40.0
  @payloadcms/live-preview-react: 3.40.0
  @payloadcms/next/utilities: 3.40.0
  @payloadcms/translations: 3.40.0
  @payloadcms/ui/shared: 3.40.0
  react: 19.1.0
  react-dom: 19.1.0
Operating System:
  Platform: linux
  Arch: x64
  Version: #26~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 17 19:20:47 UTC 2
  Available memory (MB): 32041
  Available CPU cores: 12

But this hasn't changed in Version 3.41

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions