payload icon indicating copy to clipboard operation
payload copied to clipboard

DocumentDB unique error does not have keyValue in Error object, generic error shown

Open mvdve opened this issue 2 years ago • 2 comments

Link to reproduction

No response

Describe the Bug

The error message for unique field values is not working on Document DB. The keyValue variable is not present within the error object and so the generic error "something went wrong" is shown in production:

When connected to MongoDB:

ok: 0,
code: 11000,
codeName: 'DuplicateKey',
keyPattern: { slug: 1 },
keyValue: { slug: 'test' },
[Symbol(errorLabels)]: Set(0) {}

When connected to DocumentDB:

ok: 0,
operationTime: new Timestamp({ t: 1702377946, i: 1 }),
code: 11000,
[Symbol(errorLabels)]: Set(0) {}

Used here and here

To Reproduce

  • Run PayloadCMS 2.3.1 with DocumentDB
  • Create a unique field
  • Try to add two items with the same field value

Payload Version

2.3.1

Adapters and Plugins

db-mongodb

mvdve avatar Dec 12 '23 12:12 mvdve

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.

github-actions[bot] avatar Sep 07 '24 11:09 github-actions[bot]

This is reported to possibly still be an issue. We should re-check into this on v3.0

jmikrut avatar Oct 15 '24 13:10 jmikrut

Hey @mvdve - could you check if this issue is still reproducible in v3? If so, please update this thread or open a new issue referencing this one.

We’ll be closing out older v2 issues soon as we transition our focus solely to v3 and future releases. Thanks!

PatrikKozak avatar Nov 07 '25 17:11 PatrikKozak