Skip to content

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

Open
@mvdve

Description

@mvdve

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions