jeanbmar / payload-s3-upload

Send Payload CMS uploads to Amazon S3
MIT License
54 stars 9 forks source link

Problem with typing in upload configuration. #8

Closed maximilianvb closed 1 year ago

maximilianvb commented 1 year ago

Hi, I've been trying out Payload CMS and this plugin together. The typing does not work.

The CollectionConfig type built into Payload won't accept a field called s3, for example:

upload: {
    staticURL: '/assets',
    staticDir: 'assets',
    disableLocalStorage: true,
    s3: {
      bucket: 'payloadcms-storage',
      prefix: 'images', // files will be stored in bucket folder images
    },
    adminThumbnail: ({ doc }) =>
      `https://payloadcms-storage.s3.eu-west-3.amazonaws.com/images/${doc.filename}`,
  },

Not really sure what the workaround is here, maybe I missed something in how to use this plugin.

jeanbmar commented 1 year ago

Hello,

The module was intended for JavaScript initially, but I will make a change to type things since it requires little effort. In the meantime, you can extend the CollectionConfig type in Payload in order to support this module fields. See: https://github.com/jeanbmar/payload-s3-upload/pull/6/files

Cheers

jeanbmar commented 1 year ago

Closed by https://github.com/jeanbmar/payload-s3-upload/pull/9