Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

CastError: Cast to embedded failed

default discord avatar
supa4769last year

Hello, i am having trouble with collection fields, when i add "select" type to my collection inside array i get this cast to embedded error, does anyone know what am i doing wrong here or is it a bug in payload version 2.0?



{ name: 'link', type: 'group', fields: [ { name: 'type', type: 'select', defaultValue: 'BUTTON', options: ['BUTTON', 'LINK'], }, ] }



here is my full config:



export const Pages: CollectionConfig = { slug: 'pages', admin: { useAsTitle: 'title', defaultColumns: ['title', 'slug', 'updatedAt'], preview: (doc) =>

${process.env.PAYLOAD_PUBLIC_SITE_URL}/api/preview?url=${formatAppURL({ doc })}

, }, hooks: { beforeChange: [populatePublishedDate], afterRead: [], afterChange: [], }, versions: false, access: { read: adminsOrPublished, update: admins, create: admins, delete: admins, }, fields: [ { name: 'title', type: 'text', localized: true, required: true, }, { name: 'columns', type: 'select', required: true, options: [ { label: '1', value: '1', }, { label: '2', value: '2', }, { label: '3', value: '3', }, { label: '4', value: '4', }, ], }, { name: 'event', type: 'array', fields: [ { name: 'title', type: 'text', localized: true, }, { name: 'description', type: 'text', localized: true, }, { name: 'image', type: 'upload', relationTo: 'media', }, { name: 'link', type: 'group', fields: [ { name: 'type', type: 'select', defaultValue: 'BUTTON', options: ['BUTTON', 'LINK'], }, ] } ] }, { name: 'publishedDate', type: 'date', admin: { position: 'sidebar', }, }, slugField(), ], }

;



seems like updating to 2.0.9 fixed this for me

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.