founderlab/react-dropzone-s3-uploader

Cannot get it to work with Meteor

j-planet opened this issue · 3 comments

Hi, first of all, sorry for putting this under "issue". This is more of a cry for help.
Do you guys have this working with Meteor? For some reason I kept getting the "net::ERR_CONNECTION_CLOSED" error when calling the backend to retrieve that signed URL. It's as if the server route doesn't exist.
Some newbie questions:

  1. Does one have to specify the "server" in uploaderProps even if it's under the same domain?
  2. What are some ways to debug where in the chain this broke?

Here's my code:

Client-side:
`render() {
const style = {
height: 200,
border: 'dashed 2px #999',
borderRadius: 5,
position: 'relative',
cursor: 'pointer',
};

    const uploaderProps = {
        style,
        maxFileSize: 1024 * 1024 * 50,
        server: 'https://localhost:3000',
        s3Url: 'https://outfit-generator.s3.amazonaws.com/',
        signingUrlQueryParams: {uploadType: 'avatar'},
    };

    return (
        <DropzoneS3Uploader onFinish={this.handleFinishedUpload} {...uploaderProps} />
    )
}`

Server-side:
`import { Meteor } from 'meteor/meteor';
import express from 'express';

import { MAILGUN_URL, AWSAccessKeyId, AWSSecretKey } from './secrets';

Meteor.startup(() =>
{
process.env.AWSAccessKeyId = AWSAccessKeyId;
process.env.AWSSecretKey = AWSSecretKey;
process.env.AWS_ACCESS_KEY_ID = AWSAccessKeyId;
process.env.AWS_SECRET_ACCESS_KEY = AWSSecretKey;

let app = express();

app.use('/s3',
    require('react-dropzone-s3-uploader/s3router')(
        {
            bucket: 'outfit-generator',
            headers: {'Access-Control-Allow-Origin': '*'}, // optional
            ACL: 'private' // this is default
        }
    )
);

});`

Many thanks.
JJ

FINALLY got S3 upload to work with Meteor!! Put the sample code at
https://github.com/j-planet/upload-to-s3
for whoever needs it in the future.

FYI, ACL HAS TO BE set to private now. It's no longer optional.

Hey , sorry I didn't get to this before you figured it out. Thanks for coming back to post your ordeal 😬 I'll point folks to it if they have similar probs.