Skip to content
This repository has been archived by the owner on Aug 6, 2018. It is now read-only.

TypeError: Cannot read property 'substring' of undefined #100

Open
gooof opened this issue Jul 13, 2018 · 5 comments
Open

TypeError: Cannot read property 'substring' of undefined #100

gooof opened this issue Jul 13, 2018 · 5 comments

Comments

@gooof
Copy link

gooof commented Jul 13, 2018

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)
@gooof
Copy link
Author

gooof commented Jul 14, 2018

Solved.
Uppy endpoint was not a absolute path.

@gooof gooof closed this as completed Jul 14, 2018
@kvz
Copy link
Member

kvz commented Jul 16, 2018

@ifedapoolarewaju I wonder if we'd want to support relative paths? (not advocating or anything, honest question, it might be too magical and a source of more support tickets). And if we don't, if we should raise a clear error when a relative path is used?

@ifedapoolarewaju
Copy link
Contributor

I'm not sure what Uppy endpoint means in this case actually. Do we mean Uppy endpoint as in Upload target? Or endpoint as in uppy client? @gooof could you please clarify?

@gooof
Copy link
Author

gooof commented Jul 18, 2018

I meant the uppy client XHRUpload endpoint
wrong: Uppy.XHRUpload endpoint: '../upload.php?a=1&s=9bfc99e'
right: Uppy.XHRUpload endpoint: 'https://example.com/upload.php?a=1&s=9bfc99e'

	var uppy = new Uppy.Core({
              ...
	})
	uppy.use(Uppy.Dashboard, { target: '.upload-area' })
	uppy.use(Uppy.Dropbox, { target: Uppy.Dashboard, serverUrl: 'https://up.example.com' })
	uppy.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, serverUrl: 'https://up.example.com' })
	uppy.use(Uppy.ProgressBar, { target: Uppy.Dashboard })
	uppy.use(Uppy.XHRUpload, {
		endpoint: '{UPLOAD_URL}',
		getResponseError (responseText, xhr) { return new Error(JSON.parse(responseText).message) }
	})

@gooof
Copy link
Author

gooof commented Jul 18, 2018

But I reopen this, because it is possible to break up "uppy server" remotely.
That should be fixed.

@gooof gooof reopened this Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants