Open
Description
Link to reproduction
No response
Describe the Bug
Works as expected
const servers = await payload.find({
collection: "collection-slug",
depth: 0,
pagination: false,
where: {}
});
Throws error:
const servers = await payload.find({
collection: "servers",
depth: 0,
pagination: false,
});
Error: TypeError: Cannot convert undefined or null to object
at Function.entries ()
at flattenWhere
To Reproduce
use localAPI without a where field
Issue comes from:
Fix:
Replace line 34 with:
Object.entries(query ?? {}).reduce((flattenedConstraints, [key, val]) => {
Payload Version
2.32.2
Adapters and Plugins
No response