question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to upload file to S3 using @uppy/url

See original GitHub issue

I’m using the Uppy react modal component.

import React, { Component } from 'react';

import Uppy, { UppyFile } from '@uppy/core';
import { DashboardModal } from '@uppy/react';
import Url from '@uppy/url';
import AwsS3Multipart from '@uppy/aws-s3-multipart';

export class FileUpload extends Component<Props> {
	uppy: Uppy.Uppy;

	constructor(props: Props) {
		super(props);
		this.uppy = Uppy({
			id: 'MyUppy'
                         ....
                         /* -- uppy config options -- */
                }).use(Url, {
			id: 'MyUrl',
			companionUrl: process.env.REACT_APP_FILES_HOST
		})
		.use(AwsS3Multipart, {
			id: 'AwsS3Multipart',
			companionUrl: process.env.REACT_APP_FILES_HOST
		});
        }
        
        componentWillUnmount() {
		this.uppy.close();
	}

	onClose = () => {
		this.uppy.reset();
        }

        render() {
		return (
			<DashboardModal
				uppy={this.uppy}
				plugins={['MyUrl']}
				inline={false}
				open={this.props.visible}
                                  ....
                                 /* -- uppy config options -- */
                         />
		);
	}

}

This is the TypeScript code I’m using. I’m basically trying to upload files to s3 using multipart plugin from url. I have correctly configured the Uppy companion instance

var express = require('express');
var cors = require('cors');
var bodyParser = require('body-parser');
var session = require('express-session');
var companion = require('@uppy/companion');

var app = express();

var corsOptions = {
  origin: '*',
  methods: "GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS",
  optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
}

app.use(cors(corsOptions));
app.use(bodyParser.json());
app.use(session({
  secret: 'UPPY_SECRET'
}));

var options = {
  server: {
    host: 'AWS_HOST.compute-1.amazonaws.com:8080',
    protocol: 'http',
  },
  filePath: './uploads',
  providerOptions: {
    s3: {
      getKey: (req, filename) => {
        var date = (new Date()).getTime();
  return date + '-' + filename;
      },
      key: 'AWS_KEY',
      secret: 'ASW_SECRET',
      bucket: 'ASW_BUCKET',
      region: 'AWS_REGION'
    }
  }
};

try {
  var server = app.listen(8080);
  companion.socket(server, options);
  app.options('*', cors(corsOptions));
  app.use(companion.app(options));
} catch (error) {
  console.log(error);
}

Am I missing something here? When I try to upload using URL, I see an OPTIONS call to /url/meta followed by a POST call to /url/meta which returns an object like

{"type":"image/png","size":13504}

After this nothing happens. I don’t see any other network activity after this. What am I missing here?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:11

github_iconTop GitHub Comments

3reactions
sagar7993commented, Dec 19, 2019

I’m still experiencing this issue.

On Tue, Dec 17, 2019, 10:21 PM Artur Paikin notifications@github.com wrote:

Hi @sagar7993 https://github.com/sagar7993, sorry for the delay. Was the issue resolved?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/transloadit/uppy/issues/1907?email_source=notifications&email_token=ABZB5BQKHVP3LANORVDRQ4LQZD7SFA5CNFSM4JDLQV2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHDGIFY#issuecomment-566649879, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZB5BSDOBBL3XLTEE2QZ33QZD7SFANCNFSM4JDLQV2A .

0reactions
stale[bot]commented, Jun 29, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve errors uploading data to or downloading data ... - AWS
First, follow the steps below to run the SELECT INTO OUTFILE S3 or LOAD DATA FROM S3 commands using Amazon Aurora. If you...
Read more >
Unable to upload file to bucket due to network error
Hi, We are unable to upload a ~30 MB mp4 video file to a bucket. The upload fails at 0% again and again...
Read more >
Import From URL - Uppy
The @uppy/url plugin allows users to import files from the internet. ... Companion will download the files and upload them to their destination....
Read more >
Unable to upload file to S3 bucket - Stack Overflow
You have to use --recursive option to upload a folder: aws s3 cp --recursive “D:\WindowsImageBackup” s3://ad-backup/.
Read more >
Unable to upload and download files from S3 storage
The time on the Storage Connector server is not synchronized with the S3 storage. Storage Connector verifies the uploads with a GET command,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found