ValidationError: The following field is invalid #1800
Answered
by
jmikrut
shakibdshy
asked this question in
Q&A
-
Collectionsconst Surah: CollectionConfig = {
slug: "surah",
admin: {
useAsTitle: "name",
defaultColumns: [
"name",
"id",
'variations',
"publishDate",
'status'
],
group: "Content"
},
access: {
read: ({ req: { user } }) => {
if (user) {
return true;
}
return {
and: [
{
publishDate: {
less_than: new Date().toJSON(),
},
_status: {
equals: 'published',
},
},
],
};
}
},
versions: {
drafts: true,
},
fields: [
{
name: "name",
type: "text",
localized: true,
},
{
name: 'quranPage',
type: 'relationship',
relationTo: 'quranPage'
required: true,
hasMany: true,
admin: {
position: 'sidebar',
},
},
]
}
export default Surah; Variations Collectionconst QuranPage: CollectionConfig = {
slug: 'quranPage',
admin: {
useAsTitle: 'name',
defaultColumns: ['name', 'id', 'archived'],
group: 'Content',
},
access: {
read: () => true,
},
fields: [
{
name: 'name',
type: 'text',
localized: true,
},
{
name: 'summary',
type: 'ui',
admin: {
position: 'sidebar',
components: {
Field: QuranPageSummary,
}
}
}
],
}
export default QuranPage; When I try to save this collection this showing [16:30:52] ERROR (payload): ValidationError: The following field is invalid: quranPage
at new ExtendableError (E:\MERN Project\quranicdeen\quranicdeen-admin\node_modules\payload\src\errors\APIError.ts:26:11)
at new APIError (E:\MERN Project\quranicdeen\quranicdeen-admin\node_modules\payload\src\errors\APIError.ts:43:5)
at new ValidationError (E:\MERN Project\quranicdeen\quranicdeen-admin\node_modules\payload\src\errors\ValidationError.ts:8:5)
at beforeChange (E:\MERN Project\quranicdeen\quranicdeen-admin\node_modules\payload\src\fields\hooks\beforeChange\index.ts:52:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at update (E:\MERN Project\quranicdeen\quranicdeen-admin\node_modules\payload\src\collections\operations\update.ts:202:16)
at updateHandler (E:\MERN Project\quranicdeen\quranicdeen-admin\node_modules\payload\src\collections\requestHandlers\update.ts:23:17) MongoDb |
Beta Was this translation helpful? Give feedback.
Answered by
jmikrut
Jan 3, 2023
Replies: 1 comment 1 reply
-
Hey @shakibdshy — this does not appear to be an issue with Payload and is more likely related to your config itself. I'm going to convert this to a discussion but we can keep conversation going there. I do not see a field called |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zubricks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @shakibdshy — this does not appear to be an issue with Payload and is more likely related to your config itself. I'm going to convert this to a discussion but we can keep conversation going there.
I do not see a field called
quranPage
anywhere in the configs that you've provided. Where is that field located? This error is generated by Payload when a provided field's value is not valid.