#unhandledRejection TypeError: Cannot read properties of undefined (reading 'mime')

4 messages · Page 1 of 1 (latest)

tropic knoll
#

Recently trying to seed some .svg media but encounter this error.

vernal matrixBOT
tropic knoll
#

Here is my media collection

export const Media: CollectionConfig = {
  slug: 'media',
  upload: {
    staticDir: path.resolve(__dirname, '../../media'),
    mimeTypes: ['image/png','image/svg'],
  },
  access: {
    read: () => true,
  },
  fields: [
    {
      name: 'alt',
      type: 'text',
      required: true,
    },
  ]
}
#

Here is the code when I trying to seed the svg

    await payload.create({
      collection: 'media',
      filePath: path.resolve(__dirname, './media/lang-icon-t.svg'),
      data: {
        alt: 'TranslateIcon',
        mimeType: 'image/svg',
      },
    }),