How to retrieve presigned url for video after successful upload (using AWS S3)

For starters, my stack is React on the front end, with a Rails API using Shrine.

I’m trying to show a preview for an uploaded video before submitting a form. It’s important to emphasize that this is specifically for a video upload, not an image. So the 'thumbnail:generated' event will not apply here.

I can’t seem to find any events that uppy provides that returns a cached video preview (like thumbnail:generated does) or anything that passes back a presigned url for the uploaded file (less expected, obviously), so the only option I see is constructing the url manually. Here’s what I’m currently trying for that (irrelevant code removed for brevity):

import React, { useEffect, useState } from 'react'

import AwsS3 from '@uppy/aws-s3'
import Uppy from '@uppy/core'
import axios from 'axios'
import { DragDrop } from '@uppy/react'

import { API_BASE } from '../../../api'

const constructParams = (metadata) => ([
].join('').replaceAll('/', '%2F'))

const MediaUploader = () => {
  const [videoSrc, setVideoSrc] = useState('')

  const uppy = new Uppy({
    meta: { type: 'content' },
    restrictions: {
      maxNumberOfFiles: 1
    autoProceed: true,

  const getPresigned = async (id, type) => {
    const response = await axios.get(`${API_BASE}/s3/params?filename=${id}&type=${type}`)

    const { fields, url } =
    const params = constructParams(fields)
    const presignedUrl = `${url}/${fields.key}${params}`
    console.log('presignedUrl from Shrine request data: ', presignedUrl)

  useEffect(() => {
      .use(AwsS3, {
        id: `AwsS3:${Math.random()}`,
        companionUrl: API_BASE,

    uppy.on('upload-success', (file, _response) => {
      const { type, meta } = file

      // First attempt to construct presigned URL here
      const url = ''
      const params = constructParams(meta)
      const presignedUrl = `${url}/${meta.key}${params}`
      console.log('presignedUrl from upload-success data: ', presignedUrl)
      // Second attempt to construct presigned URL here
      const id = meta.key.split(`${process.env.REACT_APP_ENV}/cache/`)[1]
      getPresigned(id, type)
  }, [uppy])

  return (
    <div className="MediaUploader">
      <div className="Uppy__preview__wrapper">
          src={videoSrc || ''}
      {(!videoSrc || videoSrc === '') && (
            strings: {
              dropHereOr: 'Drop here or %{browse}',
              browse: 'browse',

export default MediaUploader

Both urls here come back with a SignatureDoesNotMatch error from AWS.

The manual construction of the url comes mainly from constructParams. I have two different implementations of this, the first of which takes the metadata directly from the uploaded file data in the 'upload-success' event, and then just concatenates a string to build the url. The second one uses getPresigned, which makes a request to my API, which points to a generated Shrine path that should return data for a presigned URL. API_BASE simply points to my Rails API. More info on the generated Shrine route here.

It’s worth noting that everything works perfectly with the upload process that passes through Shrine, and after submitting the form, I’m able to get a presigned url for the video and play it without issue on the site. So I have no reason to believe Shrine is returning incorrectly signed urls.

I’ve compared the two presigned urls I’m manually generating in the form, with the url returned from Shrine after uploading. All 3 are identical in structure, but have different signatures. Here are those three urls:

presignedUrl from upload-success data:

presignedUrl from Shrine request data:

presigned url displayed on site after form submission:

The first two urls come back with SignatureDoesNotMatch, while the third url properly plays the video.

I’m aware the first and third urls have the same file name, while the second url does not. I’m not sure what to make of that, though, but the relevance of this is secondary to me, since that solution was more of a last ditch effort anyway.

I’m not at all attached to the current way I’m doing things. It’s just the only solution I could come up with, due to lack of options. If there’s a better way of going about this, I’m very open to suggestions.

Thanks for reading!