DocumentDB unique error does not have keyValue in Error object, generic error shown
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) {}
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
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.
This is reported to possibly still be an issue. We should re-check into this on v3.0
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!