Uppy: setFileMeta not passing params after upgrade

Created on 4 May 2020  路  5Comments  路  Source: transloadit/uppy

The code works in our app using the following:

"@uppy/aws-s3": "1.5.2",
"@uppy/core": "1.8.2",
"@uppy/dashboard": "1.6.2",
"@uppy/drag-drop": "1.4.5",
"@uppy/react": "1.4.5",
"@uppy/status-bar": "1.5.2",

Application Code:

const uppy = Uppy({
    debug: false,
  })
    .use(UppyDashboard, {
      trigger: `.upload-item-${taskListItem.id}-files`,
      showProgressDetails: true,
    })
    .use(AwsS3, {
      getUploadParameters(file){
        const attachment = {
          attachable_id: taskListItem.id,
          attachable_type: 'TaskListItem',
          attachment_type: 'deliverable-change',
          content_type: file.type,
          file_name: file.name,
        }

        const requestOptions = {
          presign_url_only: true,
        }

        return createAttachment(attachment, requestOptions).then((result) => {
          const { data, id } = result
          const { presigned_url } = data || {}

          // Store the attachment ID in meta data so we can update later
          uppy.setFileMeta(file.id, { attachmentId: id })

          return {
            method: 'PUT',
            url: presigned_url,
            fields: [],
          }
        })
      },
    })
   .on('upload-success', (file) => {
      const {
        meta: { attachmentId },
        name,
        size,
        type,
      } = file

      if (attachmentId){
        const updated = {
          id: attachmentId,
          file_file_name: name,
          file_content_type: type,
          file_file_size: size,
        }

        updateAttachment(updated, { include_attachment_file: true })
      }
    })

When we upgrade to:

"@uppy/aws-s3": "^1.6.2",
"@uppy/core": "^1.10.2",
"@uppy/dashboard": "^1.8.3",
"@uppy/drag-drop": "^1.4.10",
"@uppy/react": "^1.6.3",
"@uppy/status-bar": "^1.6.3",

The file meta data (attachmentId) is no longer present.

We couldn't find anything in the docs that mentioned a change in how this works.

Thanks in advance for your assistance!

AWS S3 Bug

Most helpful comment

All 5 comments

@arturi @goto-bus-stop I'm running into same thing as well, and breaking our upload functionality. FWIW, it exists in the latest versions as well:

"@uppy/aws-s3": "1.6.4",
"@uppy/core": "1.10.4",
"@uppy/react": "1.6.5",

Any clues on what might be going on?

I am not sure but since it appears to happen with recent aws-s3 versions, I think we may be working with an outdated file object somewhere since https://github.com/transloadit/uppy/pull/2060.

Awesome, well done! @goto-bus-stop

Released in @uppy/aws-s3 v1.6.5. Thanks!

Was this page helpful?
0 / 5 - 0 ratings