Giter VIP home page Giter VIP logo

transloadit / uppy-server Goto Github PK

View Code? Open in Web Editor NEW
114.0 15.0 27.0 1.16 MB

[DEPRECATED] 'Uppy Server' was renamed to 'Companion' and lives inside the Uppy repo no

Home Page: https://github.com/transloadit/uppy/tree/master/packages/%40uppy/companion

License: MIT License

JavaScript 88.88% Makefile 1.43% Shell 9.28% Dockerfile 0.42%
es6 file-uploads javascript mit modular open-source resumable tus webbrowser

uppy-server's Introduction

uppy-server's People

Contributors

arturi avatar bertrandkeller avatar d-kochnov-optimus avatar damianijr avatar davidjfelix avatar dcflow avatar functino avatar goto-bus-stop avatar hedgerh avatar ifedapoolarewaju avatar kiloreux avatar kvz avatar snyk-bot avatar tersmitten avatar tim-kos avatar vially avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uppy-server's Issues

TypeError: Converting circular structure to JSON and tus error

Getting multiple errors sometimes when trying to re-upload a remote file:

  1. Circular structure to JSON, we should probably use a more safe JSON parser, like this one: https://github.com/jed/lave.
  2. Error: tus: unexpected response while creating upload, originated from request (response code: 400, response text: β€” this is the main issue.

Log:

{ action: 'success',
  payload: 
   { complete: true,
     url: 'http://master.tus.io/files/e1afd9ca33fcb15c9092144d1a572096' } }
140795 140795 '100.00%'
{ action: 'success',
  payload: 
   { complete: true,
     url: 'http://master.tus.io/files/07f4d15fe523fe0bfb24ea5399c61f04' } }
::1 - - [28/Dec/2017:21:23:52 +0000] "OPTIONS /instagram/get/1636400252659303992_104680?carousel_id=2 HTTP/1.1" 200 13 "http://localhost:3452/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
uppy-server: Found an handler for request.
uppy-server: Instantiating uploader.
uppy-server: Waiting for socket connection before beginning remote download.
::1 - - [28/Dec/2017:21:23:52 +0000] "POST /instagram/get/1636400252659303992_104680?carousel_id=2 HTTP/1.1" 200 48 "http://localhost:3452/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36"
uppy-server: Socket connection received. Starting remote download.
[nodemon] files triggering change check: output/f12038b9-f8c1-450f-8fab-be80eeaf1f8c-1636400252659303992_104680
[nodemon] changes after filters (before/after): 1/0
{ action: 'error',
  payload: 
   { error: 
      { Error: tus: unexpected response while creating upload, originated from request (response code: 400, response text: )
          at DetailedError.Error (native)
          at new DetailedError (/uppy-server/node_modules/tus-js-client/lib.es5/error.js:23:87)
          at Upload._emitXhrError (/uppy-server/node_modules/tus-js-client/lib.es5/upload.js:236:23)
          at Request.xhr.onload (/uppy-server/node_modules/tus-js-client/lib.es5/upload.js:326:18)
          at ClientRequest.<anonymous> (/uppy-server/node_modules/tus-js-client/lib.es5/node/request.js:83:15)
          at emitOne (events.js:96:13)
          at ClientRequest.emit (events.js:188:7)
          at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:474:21)
          at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
          at Socket.socketOnData (_http_client.js:363:20) originalRequest: [Object], causingError: null } } }
/uppy-server/src/uppy.js:92
      ws.send(JSON.stringify(data), (err) => {
                   ^

TypeError: Converting circular structure to JSON
    at Object.stringify (native)
    at EventEmitter.sendProgress (/uppy-server/src/uppy.js:92:20)
    at emitOne (events.js:96:13)
    at EventEmitter.emit (events.js:188:7)
    at Uploader.emitError (/uppy-server/src/server/Uploader.js:149:13)
    at Object.onError (/uppy-server/src/server/Uploader.js:170:18)
    at Upload._emitError (/uppy-server/node_modules/tus-js-client/lib.es5/upload.js:242:22)
    at Upload._emitXhrError (/uppy-server/node_modules/tus-js-client/lib.es5/upload.js:236:12)
    at Request.xhr.onload (/uppy-server/node_modules/tus-js-client/lib.es5/upload.js:326:18)
    at ClientRequest.<anonymous> (/uppy-server/node_modules/tus-js-client/lib.es5/node/request.js:83:15)
[nodemon] app crashed - waiting for file changes before starting...

Check for write permissions into DATADIR

when uppy-server is instantiated, the option UPPYSERVER_DATADIR is set for path to the download directory. It'd be nice for uppy-server to run a check during instantiation for read/write permissions to that directory

Custom tus upload metadata

Transloadit tus uploads need an assembly_url in the Upload-Metadata to tell the TL API which assembly an upload belongs to. At the moment uppy-server only passes the filename in the upload metadata (https://github.com/transloadit/uppy-server/blob/master/src/server/Uploader.js#L55)

It'd be really neat if we could specify custom tus metadata when POSTing to uppy-server, so we could add an assembly_url etc in here:
https://github.com/transloadit/uppy/blob/master/src/plugins/Tus10.js#L197

Is this functional with Koa?

Hi there,

Thanks for creating this awesome project, Uppy.

I was wondering if this is functional with Koa, as you have said in your docs ARCHITECTURE.md.

I see in the code it's actually just creating an express app, so I'm having my doubts. I've tried to mount the express app by passing Koa's Request and Response objects directly to it, but I'm having no luck as I would need to mount it at a sub-path, such as /_uppy-server to not interfere with my app, but it seems that there are no options for setting that.

I'm struggling to see how I can set this up on top of my existing Koa server implementation.

Can't have UPPY_ENDPOINTS on different protocol to UPPYSERVER_PROTOCOL

As it currently stands, uppy-server is forcing the protocol specified by UPPYSERVER_PROTOCOL on all hosts listed in UPPY_ENDPOINTS. This means that it is not possible to run uppy-server on HTTPS and connect an uppy running on HTTP (such as a development server running on localhost), as the Access-Control-Allow-Origin header won't be set as the HTTP origin won't be found in the whitelist.

In order to preserve backwards compatibility, perhaps the best way to handle this is to check for the presence of a protocol before prepending a protocol; that would allow existing configurations to continue to work unimpeded, but allow a protocol to be specified on any domain in the whitelist in order to specify one other than UPPYSERVER_PROTOCOL.

TypeError: Cannot read property 'substring' of undefined

I've setup uppy-server for image uploading from google drive, dropbox &co, and is working great until the upload.
I choose a file and click on "select", the thumbnails comes correctly up.
But when I click on "Upload files" uppy-server quits with a TypeError.

::ffff:127.0.0.1 - "GET /drive/thumbnail/0B1zj7405adOCQzh0ZUhLYUw5eEk HTTP/1.0" 200 4500 "http://domain/index.php?sid=9bfc99e" "Mozilla/5.0"
::ffff:127.0.0.1 - "OPTIONS /drive/get/0B1zj7405adOCQzh0ZUhLYUw5eEk HTTP/1.0" 200 4 "-" "Mozilla/5.0"
uppy: [debug] debugLog Instantiating uploader.
uppy: [debug] uploader.validator.fail Invalid destination url
uppy: [debug] debugLog Waiting for socket connection before beginning remote download.
/usr/lib/node_modules/uppy-server/lib/server/Uploader.js:74
        return this.token.substring(0, 8);
                          ^

TypeError: Cannot read property 'substring' of undefined
    at Uploader.get shortToken [as shortToken] (/usr/lib/node_modules/uppy-server/lib/server/Uploader.js:74:27)
    at Uploader.onSocketReady (/usr/lib/node_modules/uppy-server/lib/server/Uploader.js:82:30)
    at provider.size (/usr/lib/node_modules/uppy-server/lib/server/controllers/get.js:38:18)
    at stats (/usr/lib/node_modules/uppy-server/lib/server/provider/drive.js:59:13)
    at Request._callback (/usr/lib/node_modules/uppy-server/node_modules/purest/lib/transform.js:73:5)
    at Request.self.callback (/usr/lib/node_modules/uppy-server/node_modules/request/request.js:186:22)
    at Request.emit (events.js:182:13)
    at Request.EventEmitter.emit (domain.js:442:20)
    at Request.<anonymous> (/usr/lib/node_modules/uppy-server/node_modules/request/request.js:1163:10)
    at Request.emit (events.js:182:13)

Selfcontained log lines

Currently uppy server logs things like:

65536 93365 '70.19%'
93365 93365 '100.00%'
93365 93365 '100.00%'

If we need this log at all, it would be better to use full sentences to describe what is going on. This makes it possible to set up search patterns in the log aggregator, view individual lines without viewing others, set up alerts, etc.

I also noticed that it might be nice to have more logs in general about what is going on, and maybe settle on a prefix like an ISO 8601 date with a syslog severity log level like:

2018-02-07 10:20:21Z [debug] Something uninteresting happened
2018-02-07 10:20:21Z [info] Something slightly interesting happened
2018-02-07 10:20:21Z [notice] Something interesting happened
2018-02-07 10:20:21Z [warning] Something bad could be happening
2018-02-07 10:20:21Z [err] Something bad happened
2018-02-07 10:20:21Z [crit] Something super bad happened
2018-02-07 10:20:21Z [alert] Something super bad happened that (in production) warrants a pagerduty and someone to be woken up
2018-02-07 10:20:21Z [emerg] Something super bad happened that (in production) warrants a pagerduty and someone to be woken up, and the process halts

That's a lot of levels, I'd propose to only pick debug info err emerg from these for starters.

This again helps with setting up graphs and alerts for errors, and e.g. allow to not show debug logs, under which I'd categorize the webserver access logs such as

::ffff:127.0.0.1 - - [07/Feb/2018:10:34:57 +0000] "GET /instagram/authorized HTTP/1.1" 200 22 "http://localhost:3000/dash/uppy.html" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"

I don't think we need a fancy framework or anything, in the end it's just about writing to the stdout/err. simple log functions will do the trick imho:

  _err (...args) {
    const str = util.format.apply(this, args)
    console.error(`[${this.constructor.name} err]: ${chalk.red(str)}`)
  }

  _info (...args) {
    const str = util.format.apply(this, args)
    console.log(`[${this.constructor.name} info]: ${chalk.dim(str)}`)
  }

  _debug (...args) {
    if (process.env.DEBUG !== 'uppy-server' && `${process.env.DEBUG}`.indexOf('*:*') === -1 && `${process.env.DEBUG}`.indexOf('uppy-server:*') === -1 && `${process.env.DEBUG}`.indexOf(`uppy-server:${this.constructor.name}`) === -1) {
      return
    }
    const str = util.format.apply(this, args)
    console.log(`[${this.constructor.name} debug]: ${chalk.cyan(str)}`)
  }

how to set up uppy server in rails app?

Hello!
How we can set up uppy server in our rails app? We are already integrate uppy uploader into our app, but if we want to use other storages like google drive, dropbox and other, we need to set up uppy server, well?
We try to do this using browserify-rails gem, but we can't require 'express'.
Do we must use express to set up uppy server?
Thank for your ideas!

Error: secretOrPrivateKey must have a value

I'm trying to get uppy-server to work with dropbox:

// ...

expressApp.use(bodyParser.json());
expressApp.use(session({ secret: '...' }));

// ...

const options = {
	providerOptions: {
		dropbox: {
			key: '...',
			secret: '...',
		},
	},
	server: {
		host: `localhost:${PORT}`,
		protocol: 'http',
	},
	filePath: './uploads/'
};
expressApp.use(uppy.app(options));

// ...

but after connecting to dropbox / redirecting to http://localhost:3000/dropbox/callback I get this error:

Error: secretOrPrivateKey must have a value
    at Object.module.exports [as sign] (/path/to/project/node_modules/jsonwebtoken/sign.js:102:20)
    at Object.module.exports.generateToken (/path/to/project/node_modules/uppy-server/lib/server/token-service.js:8:16)
    at Object.callback [as self] (/path/to/project/node_modules/uppy-server/lib/server/controllers/callback.js:23:40)
    at routeDispatcher (/path/to/project/node_modules/uppy-server/lib/server/controllers/dispatcher.js:34:20)
    at Layer.handle [as handle_request] (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/layer.js:95:5)
    at next (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/layer.js:95:5)
    at /path/to/project/node_modules/uppy-server/node_modules/express/lib/router/index.js:281:22
    at param (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/index.js:354:14)
    at param (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/index.js:365:14)
    at paramCallback (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/index.js:401:21)
    at middleware (/path/to/project/node_modules/uppy-server/lib/server/provider/index.js:76:9)
    at paramCallback (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/index.js:404:7)
    at param (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/index.js:384:5)
    at Function.process_params (/path/to/project/node_modules/uppy-server/node_modules/express/lib/router/index.js:410:3)

looks like req.uppy.options.secret is undefined here https://github.com/transloadit/uppy-server/blob/master/src/server/controllers/callback.js#L24

Question: Uppy-Server and serverless? What about websockets?

Hi, I tried to run your serverless example on AWS lambda.
Uploading from local finally works, but what about IG photos and uploading to S3?
AWS Lambda doesn't support websockets.

Is really possible to have uppy-server with serverless?
I love your solution, but please could you extend your serverless example?

Thanks, Ales

Trouble with connecting to google drive

Hello, i have some troubles with connect to google drive.
I run standalone uppy server(localhost:3020) parallel to my rails app(localhost:5000), I registered in console.developers.google.com, create a new project.
image
The Client I paste to "UPPYSERVER_GOOGLE_KEY", Client secret I paste to "UPPYSERVER_GOOGLE_SECRET".
Have I filled everything correctly? Have i filled correctly "Authorized JavaScript origins
" field? When i try to to Connect to Google Drive I get this error:
image
What am I doing wrong?

Custom Provider: first attempt

Hey guys,

I have a Rails app with OAuth2 up and running. I'm trying to create my own custom provider, but I'm not so good in js develpment.

Here you say to add
let options = {...}
uppy.app(options)

Where should I add that code? I tried in src/uppy.js, with module defined in src/server/provider, but there are undefined errors.

So I tried to find every Dropbox word and add with sense MyProvider, but still does not work. The error client side is

Uncaught TypeError: Expected a plugin class, but got undefined. Please verify that the plugin was imported and spelled correctly.

In my client side code should I use
.use(Uppy.MyProvider, {target: Uppy.Dashboard, host: 'http://localhost:3020'}) ?

Thank you!

config file ignored

Hello,

I wanted to set up a standalone server based on the docs:
package.json

"scripts":{
    "start": "node ./node_modules/uppy-server/lib/standalone/start-server.js --config ./config.json",
}

config.json:

{
  "UPPYSERVER_SECRET": "my-super-secret",
  "UPPYSERVER_DOMAIN": "https://uppy-server.mydomain.com,localhost:3020",
  "UPPYSERVER_DATADIR": "/mnt/server-data",
  "UPPYSERVER_PATH": "",
  "UPPYSERVER_PROTOCOL":"HTTPS",
  "UPPYSERVER_PORT": 3020
}

I only receive following error message (it seems that --config does not work?

uppy: 2018-07-05T08:47:06.788Z [warn] startup.secret auto-generating server secret because none was specified
 Please specify the following options to run uppy-server as Standalone:
 "filePath",
"server.host" 

Any idea what I am doing wrong? Thanks

No session/body attached to req object. Exiting dispatcher.

Hi guys,

First of all, great client & great server, I'm in love with it.

I've setupped a node server to use both tus-node-server for the tus resumable uploads & uppy-server for the google / dropbox / instagram providers.

Tus uploads are fine, I'm having issues with the uppy-server, when I click 'connect to dropbox' button on my local app, I get this error from uppy-server

uppy-server: No session/body attached to req object. Exiting dispatcher.
:1 - - [01/Feb/2018:13:59:35 +0000] "GET /dropbox/connect?state=somestate HTTP/1.1" 404 154 "http://localhost:4300/web/document/add" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"

this is my code.

const app: any = express();

app.use(morgan('combined'));
app.use(cors({
  origin: 'http://localhost:4300',
  credentials: true
}));

app.use(bodyParser.json())

const options = {
  providerOptions: {
    google: {
      key: "***",
      secret: "***"
    },
    dropbox: {
      key: "***",
      secret: "***"
    },
    instagram: {
      key: "***",
      secret: "***"
    }
  },
  server: {
    host: "localhost:3020",
    protocol: "http"
  },
  filePath: "files",
  endSelfEndpoint: "localhost:3020",
  secret: 'mysecret',
  uploadUrls: ['http://localhost:3020'],
  debug: true
}

app.use(uppy.app(options));

What am I doing wrong?

Thanks!
Luca

does uppy-server support multipart?

Uppy-server has body-parser as a dependency. On their repo I find that it

does not handle multipart bodies

As a total nitwit in this area this kind of suprises me? Does uppy-server not require something like multer to facilitate multipart. This idea of mine stems from this article.

Rename `host` and `hostPattern`

Host is usually: jane.transloadit.com but since host in our case contains a full url with many more components (protocol, path, etc), I'd vote to name it endpoint.

hostPattern could than be named allowedOrigins which could either take (an array for a list of flat origins, a function to be executed on a string which returns true or false, or) a RegExp.

The proposals are up for discussion, but I do think a change is needed.

For BC-compat, we could likely still accept host and throw a Deprecation warning at the console for a release or two.

TypeError: e.getResponseHeader is not a function

Hi guys,

thank you for this awesome library! I have a little issue, I'm not very skilled in js and I can't find a solution.

I have a rails app running on port 3452 (as described here) with Uppy up and running. Everything works like a charm when I upload files or take a photo from my webcam, it uploads correctly on my s3-bucket and I'm super happy. Now I want to extend, with uppy-server, for dropbox, drive & co.

As explained in the docs I copied uppy server, installed, set keys in env.sh (they are test keys, I'll change them lol)
export UPPYSERVER_SECRET="this_is_a_fucking_secret"
export UPPYSERVER_DOMAIN="localhost:3020"
export UPPYSERVER_DATADIR="/alagaesias_output"

both in uppy.js (in options variable) and in env.sh.

Now I try to gather a file from Dropbox from localhost:3452, it shows me all my files, I select a photo, it starts the upload and never completes, with a js error in console. This is the console log, with debug options set to true and attached image:

UppySocket.js:54 progress
UppySocket.js:54 success
UppySocket.js:54 error
UppySocket.js:70 {action: "progress", payload: {…}}
UppySocket.js:59 progress
UppySocket.js:70 {action: "success", payload: {…}}
UppySocket.js:59 success
UppySocket.js:73 TypeError: e.getResponseHeader is not a function
at w (index.js:7)
at Object.getResponseData (index.js:141)
at Function. (XHRUpload.js:325)
at index.js:131
at Object.e.emit (index.js:124)
at e.emit (UppySocket.js:60)
at e._handleMessage (UppySocket.js:71)

image

What is the error? How can I solve it?

Please note I can find the uploaded file (from Dropbox) in my s3-bucket, so the upload works, but I suppose it raises an error somewhere, and same thing happens with Drive.

Uppy Client is included via CDN, Uppy Server is up and running in npm.

Thank you very much in advance!

Standalone uppy-server doesn't use HTTPS

I'm trying to start the standalone uppy-servrer using HTTPS.
Before starting the server I set the following environment variable:

export UPPYSERVER_PROTOCOL="https"

But then when I run npm start the server uses HTTP, also shown in the server output;:

> [email protected] start /var/www/html/vclass/uppy-server
> node ./lib/standalone/start-server.js

uppy: 2018-04-03T15:55:12.585Z [info] jobs.cleanup.start starting clean up job
Welcome to Uppy Server! v0.11.2
Listening on http://0.0.0.0:3020
^Cubuntu@ip-172-31-36-126:/var/www/html/vclass/uppy-server$ npm start                                                                                                                             
> [email protected] start /var/www/html/vclass/uppy-server
> node ./lib/standalone/start-server.js

uppy: 2018-04-03T15:55:20.122Z [info] jobs.cleanup.start starting clean up job
Welcome to Uppy Server! v0.11.2
Listening on http://0.0.0.0:3020

Do I need to set any other configuration option?

I installed a server letsencrypt SSL certificate using certbot for apache as documented below:
https://certbot.eff.org/lets-encrypt/ubuntuxenial-apache

Upload from SSH server to another SSH server

I have a file server (A) in which my files are uploaded by some third parties. I access this server A through ssh. And I have an ownCloud server (B). I also access it through SSH.

Basically I would like to upload from A to B using uppy, because I love the fact that the file is not downloaded on the client-side and I love the resumable capability of tus.io protocol. Therefore I would like to benefit from these solution for my case.

How would you recommend me to do it? Is there any way I could have an "SSH provider" in uppy-server which would use for instance a private SSH key to connect? And an "uppy plugin" to select my files from the remote server?

Thanks in advance for your help!

Update to Drive API v3 and enable Team Drives

At a quick glance, it appears that the Google Drive integration is currently using the Drive API v2, via the @purest/providers default 'google' config. If this is the case, Team Drive support (the ultimate aim of this ticket) unfortunately can't be enabled without first upgrading to Drive API v3.

I'm not familiar with purest, but it looks as though a custom config can easily be passed in to flip over to v3. Hopefully the changes required to migrate existing functionality to v3 would be reasonably small - and once on v3, supporting Team Drives looks to be relatively straightforward (I'm not sure how much of this affects uppy-server, or whether the Team Drive support would only affect uppy itself).

LocalDisk Provider and Tus Upload handling

The docs are listing Local disk as a supported provider - but there is no documentation on this topic anywhre. Also - does uppy-server support direct uploading via Tus or is tus-server needed for this seperatly?

documentation mistaken?

Hi,

I am unable to register google drive as a provider when using this as an Express middleware.

Re: https://github.com/transloadit/uppy-server/blob/master/src/server/provider/index.js#L68:

const middleware = (req, res, next, providerName) => {
    if (providers[providerName] && validOptions(req.uppy.options)) { <- this check always fails

I'm getting main for providerName here (not sure why), and providers are listed as follows:

{ dropbox: [Function: DropBox],
  drive: [Function: Drive],
  instagram: [Function: Instagram] }

I'm attaching to an Express server, so following the docs I'm doing this:

var app = express()
app.use(bodyParser.json())
...
// be sure to place this anywhere after app.use(bodyParser.json())
const options = {
  providerOptions: {
    google: {
      key: 'my key',
      secret: 'my secret'
    }
  },
  server: {
    ...
  },
  filePath: '...'
}

app.use(uppy.app(options))

Note that the docs show google as a provider, when it seems drive is the correct key.

And of course where is main coming from?

Thanks!

404 HTTP error for Dropbox file operations

After authenticating with Dropbox, only the list operation of the root folder works. When I try to list Dropbox sub-folders or get files, the standalone uppy-server returns 404 error because it appends an extra / before the file or folder name, e.g.

/dropbox/get//filename.ext was not found on this server.

When I manually remove the additional / and paste the link directly to the browser I get the following message:

"No endpoint, file written to uppy server local storage"

In the uppy-server output I see the following error message:

uppy: 2018-04-04T01:51:00.891Z [error] provider.dropbox.size.error Error in call to API function "files/get_metadata": request body: path: 'filename.ext' did not match pattern '(/(.|[\r\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?)'

When connecting to Google Drive, the blocking warning shows

Preview:

screen shot 2018-03-02 at 14 30 27

How to reproduce

  1. If you authorized Google Drive integration earlier, remove this authorization in Google Drive settings.
  2. Open Uppy Dashboard (e.g. here https://uppy.io/examples/dashboard/), choose Google Drive and press Connect to Google Drive.
  3. You'll see a warning which may scare some customers off (see the screenshot above).

How to fix it

Here is some official documentation: https://support.google.com/cloud/answer/7454865?authuser=0

Issue dockerizing uppy-server

I tried to build the image with my configuration for docker. I successfully build the image either with "docker build ." within the cloned directory or with "docker-compose up". I run a container with the flag of --env-file providing all needed environment variables and this also runs successfully with no issues. I also that uppu server is up n running on Port 3020. Unfortunately, when I proceed to the client index.html file I tried to upload the files to a specific directory that is configured and I get error 404 ... Error of uploading the files.

stop uppy-server

Hello there!
I'm using uppy-server as standalone server and running him from Procfile of my project. And sometimes when i stop my own server, uppy-server doesn't stop. Then i must delete running command of uppy-server from Procfile. That's very not comfortably. How can i stop uppy-server manually?

Nodejs support for uppy server

Hello,
I was wondering if uppy server has any documentation for nodejs server to handle file uploading?
Any example on how to pass file metadata/information from uppy (front end) to nodejs backend and then use those information to save in database?
Thank you

SECURITY: Vulnerability in transient dependency

Here is the output of NSP:

yarn run nsp check
yarn run v1.3.2
$ /.bin/nsp check
(+) 1 vulnerability found
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            β”‚ Prototype pollution attack                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Name       β”‚ hoek                                                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ CVSS       β”‚ 4 (Medium)                                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Installed  β”‚ 2.16.3                                                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Vulnerable β”‚ <= 4.2.0 || >= 5.0.0 < 5.0.3                                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Patched    β”‚ > 4.2.0 < 5.0.0 || >= 5.0.3                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Path       β”‚ redacted > [email protected] >                  β”‚
β”‚            β”‚ [email protected] > [email protected] > [email protected] > [email protected] >  β”‚
β”‚            β”‚ [email protected]                                                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ More Info  β”‚ https://nodesecurity.io/advisories/566                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Also see simov/grant/issues/86 for the issue in the project which can actually fix the problem.

Stale authentication

When you connect to Instagram or Google Drive, and then wait for a while, leaving your tab open in the background, for example, authentication times out. But no UI indication for that is shown, so both the list of files for selection, and the files you’ve added are still there β€” you can select new files and start uploading, but it will error, because authentication is times out.

Proposal: check every X seconds (30?) that we are still authenticated, and update state, so that it will kick you out to the β€œauthenticate” screen. Maybe remove files that are no longer accessible due to authentication, or ask to re-select too?

screen shot 2018-03-21 at 6 35 10 pm

Should we upgrade to Grant 4?

On 14 March 2018 at 15:05:03, Simeon Velichkov ([email protected]) wrote:

πŸ‘‹ I'm the author of Grant

I've released Grant v4.0, here is the: https://github.com/simov/grant/blob/master/CHANGELOG.md#v400-20180314

Internally I've dropped the request dependency which will
result in:

  • less dependencies
  • lower memory footprint of the HTTP server consuming Grant
  • less vulnerability issues constantly popping out of request's
    deps

There should be only one breaking change regarding the error
handling in the final callback based on the transport type
used, which should be set to session anyway.

Let me know if you have any issues!

Simo

How do I connect to instagram account

I am running parse server. It runs on localhost:1337.

In my server, I have invoked uppy like this:
server.js

var bodyParser = require('body-parser')
var uppy = require('uppy-server')
const session = require('express-session')


var app = express();
app.use(bodyParser.json())
app.use(session({
  secret: 'some-secret',
  resave: true,
  saveUninitialized: true
}))

const options = {
  providerOptions: {
    instagram: {
      key: 'MY_IG_KEY',
      secret: 'MY_IG_SECRET'
    }
  },
  server: {
    host: 'localhost:3020', // I have also tried adding localhost:1337 here, where my parse server runs
    protocol: 'http',
  },
  filePath: '/output',
  sendSelfEndpoint: "localhost:3020", //  have also tried adding localhost:1337 here, where my parse server runs
  secret: 'some-secret',
  debug: true
};

app.use(uppy.app(options))

// Rest of custom server code. Not related to uppy config

Now, when I start my server, with node server.js, it logs the following error:

uppy: Invalid provider options detected. Provider will not be loaded
uppy-server: No provider/provider-handler found. Exiting dispatcher.

** Client **
My client is a simple starter create-react-app running on server localhost:3000.
I use: .use(Instagram, { host: 'http://localhost:1337' }) to connect to my server, and the uppy dashboard displays Could not connect to uppy server.

** Instagram **
I have used many redirect-uri on instagram and none of them work:
http://localhost:1337/connect/instagram/callback
http://localhost:3000/connect/instagram/callback

Can, somebody tell me what am I missing?

Uploading files to S3 after pulling them from Dropbox results in "Bucket POST must contain a field named 'key'" AWS error

Hi,

I'm running uppy-server 0.10.1 in standalone mode. I got the S3 uploader working for local files (i.e., I can successfully drop local files into the Dashboard and they are successfully uploaded to my S3 bucket, with uppy-server doing the signing).

I also got the Dropbox integration working, that is, I can successfully browse and select my Dropbox files with the Dashboard.

What is NOT working is the upload of files I have selected with the Dropbox plugin to S3. uppy-server successfully pulls the files from Dropbox to its local file system, but when it tries to upload the files to S3, it errors at

if (error || response.statusCode >= 400) {

I console.dir'd the response from AWS, and it says:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>InvalidArgument</Code>
  <Message>Bucket POST must contain a field named 'key'.  If it is specified, please check the order of the fields.</Message>
  <ArgumentName>key</ArgumentName>
  <ArgumentValue></ArgumentValue>
  <RequestId>...</RequestId>
  <HostId>...</HostId>
</Error>

You can see the full content of response.request at https://gist.github.com/manuelkiessling/3b4d1450624610d505c918501acb1a4a.

Lambda Support

Hello,

What do you guys think of uploading the server to Lambda?
How should we approach this, bundle all the src together
or we can strip out some parts.

Thank You!

Google Drive provider not found in standalone mode

Hi there

Looks like Google Drive integration doesnt work properly in standalone mode.

Preconditions:

  1. uppy-server 0.9.0 running in docker container (standalone mode)
  2. went to Google Drive tab, press Authenticate button
  3. Google login form displayed - entered credentials and logged in

1

Expected result:

  1. Returned to my site, Drive explorer is opened

Actual result:

  1. Facing error

2

  1. Message from docker container

3

(uppy_1  | uppy: Invalid provider options detected. Provider will not be loaded
uppy_1  |  Error: Not Found
uppy_1  |     at app.use (/app/src/standalone/index.js:110:15)
uppy_1  |     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
uppy_1  |     at trim_prefix (/app/node_modules/express/lib/router/index.js:312:13)
uppy_1  |     at /app/node_modules/express/lib/router/index.js:280:7
uppy_1  |     at Function.process_params (/app/node_modules/express/lib/router/index.js:330:12)
uppy_1  |     at next (/app/node_modules/express/lib/router/index.js:271:10)
uppy_1  |     at /app/node_modules/express/lib/application.js:232:9
uppy_1  |     at /app/node_modules/express/lib/router/index.js:618:15
uppy_1  |     at next (/app/node_modules/express/lib/router/index.js:256:14)
uppy_1  |     at next (/app/node_modules/express/lib/router/route.js:121:14) 
uppy_1  | ::ffff:172.20.0.3 - - [02/Dec/2017:10:50:55 +0000] "GET /google/redirect?state)
  1. Figured out that error happens in lib/server/provider/index.js:
  • if (providers[providerName] ...) - provider name is google (according action name is URL, see first attach)
  • there is no providers['google'] element, but there is providers['drive']

So please fix this or tell me what am i doing wrong.

Regards, Nikolay

how to connect my rails app with parallel running uppy-server

Hello!
I have my rails app, where I run uppy, but i need to use dropbox, google drive, instagam and others cloud storage, and I run a stand-alone uppy server in parallel running, I start it together it in my procfile. How i can connect my rails app and uppy-server. Please don't offer me transloadit, I need to solve my problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.