MissingFieldType: Field is either missing a field type or it does not match an available field type
What thought process can I take to understand where the error is located? I've copy/pasted the Payload website fields folder, so there are many field types defined.
@taun2160 Good morning Taun! The error should indiciate where it occurred, can you provide a screenshot / more error context and we will be happy to help resolve!
Hi Chris. Thanks!
[nodemon] starting `ts-node src/server.ts`
[06:20:52] INFO (payload): Connected to MongoDB server successfully!
[06:20:52] INFO (payload): Starting Payload...
MissingFieldType: Field is either missing a field type or it does not match an available field type
at F:\git\Melex_4\payload\node_modules\payload\src\fields\config\sanitize.ts:15:28
at Array.map (<anonymous>)
at sanitizeFields (F:\git\Melex_4\payload\node_modules\payload\src\fields\config\sanitize.ts:12:17)
at F:\git\Melex_4\payload\node_modules\payload\src\fields\config\sanitize.ts:85:59
at Array.map (<anonymous>)
at sanitizeFields (F:\git\Melex_4\payload\node_modules\payload\src\fields\config\sanitize.ts:12:17)
at F:\git\Melex_4\payload\node_modules\payload\src\globals\config\sanitize.ts:93:44
at Array.map (<anonymous>)
at sanitizeGlobals (F:\git\Melex_4\payload\node_modules\payload\src\globals\config\sanitize.ts:12:36)
at sanitizeConfig (F:\git\Melex_4\payload\node_modules\payload\src\config\sanitize.ts:33:46)
[nodemon] app crashed - waiting for file changes before starting...
`
Hmm
OK so I can not tell from the log there, but one of your fields is misconfigured. Do you have any recently made collections I can check out to see if everything looks OK?
Kinda hacky, and we could likely expose a better error, but you could edit the payload/dist/collections/config/sanitize function and log the collection slug, that will likely help you pinpoint at least the collection with the bad field
Thanks @notchr and @jarrod_not_jared . If you're refering to the folder tree of the project - the 'dist' folder only has a folder 'fields', containing richText folder. In the payload-cms-main folder there isn't a dist folder. To be honest, I don't know where the dist folder in my project came from, I assume it was created when I created a payload-app, I don't know.
@notchr - I think I may have found the culprit -
import { GlobalConfig } from 'payload/types';
import link, { Type as LinkType } from '../fields/link';
export type Type = {
nav: {
link: LinkType
}[]
}
const MegaMenu: GlobalConfig = {
slug: 'mega-menu',
label: 'Mega Menu',
access: {
read: () => true,
},
fields: [
{
name: 'nav',
label: 'Navigation',
type: 'array',
labels: {
singular: 'Link',
plural: 'Links',
},
fields: [
link,
],
},
],
};
export default MegaMenu;
Module '"../fields/link"' has no exported member 'Type'. Did you mean to use 'import Type from "../fields/link"' instead?ts(2614)
Module '"../fields/link"' has no exported member 'Type'. Did you mean to use 'import Type from "../fields/link"' instead?
Oh I meant in the node modules folder
node_modules/payload/dist….
Cool, thanks, heading out now, I'll try the debug method you mentioned when I get back.
I removed the MegaMenu with the Payload website MainMenu global and cleaned up a few fields and all good now, thanks for the help.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.