Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
Led to the The following path cannot be queried: secret error because where input to validateQueryPaths also includes the result from access control, which shouldn't be.
This works when using payload.find.
The same applies to find with drafts / joins where. We need to validate only user where input, not access control that we defined in our config.
What?
Previously,
payload.findByID
withoverrideAccess: false
and this collection configLed to the
The following path cannot be queried: secret
error becausewhere
input tovalidateQueryPaths
also includes the result from access control, which shouldn't be.This works when using
payload.find
.The same applies to find with drafts / joins
where
. We need to validate only userwhere
input, not access control that we defined in our config.Also, this exact logic seems be used in
find
without drafts - we don't usefullWhere
here butwhere
, that's why this error isn't being thrown withfind
but onlyfindByID
. https://github.com/payloadcms/payload/blob/d9c6288cb20f8bdcc6e4e85705640952018cadd1/packages/payload/src/collections/operations/find.ts#L134 https://github.com/payloadcms/payload/blob/d9c6288cb20f8bdcc6e4e85705640952018cadd1/packages/payload/src/collections/operations/find.ts#L166-L171Fixes https://github.com/payloadcms/payload/issues/9210