Hi guys, first of all thank you to the devs for this fantastic plugin!
I want the user to select an image from GDrive (already working), and have companion fetch the image and reupload it to my node express server as a multipart form (to an /api/drop/upload-photo endpoint).
I’v companion attached to my express app using these options:
const companionOptions = {
providerOptions: {
google: {
key: googleOauthKeys.key,
secret: googleOauthKeys.secret
}
},
server: {
host: ‘localhost:3000’,
protocol: ‘http’,
},
debug: true,
secret: “nevergonnagiveyouup”,
filePath: path.join(__dirname, ‘…/uploads’),
}
And uppy options on clientside:
uppy.use(Uppy.Dashboard, { trigger: ‘.open-uppy’ })
uppy.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: http://localhost:3000’})
uppy.use(Uppy.XHRUpload, { endpoint: ‘/api/drop/upload-photo’, fieldName: ‘photo’ })
After selecting a file from GDrive, by clicking the Upload button on the dashboard I get these errors:
On the node app:
companion: 2019-09-26T17:12:32.963Z [debug] Instantiating uploader.
companion: 2019-09-26T17:12:32.967Z [debug] uploader.validator.fail No destination specified
On the client:
RequestClient.js:169 Uncaught (in promise) Error: Could not post http://localhost:3000/drive/get/1134trICiqhhISWCEpztmMRdW7AfYpOLh. Error: Failed request with status: 400. Bad Request
I’v tried debug the issue and created a simple middleware placed before uppy to log any request. Found that the request to companion has no body (empty object)
Before uppy, my app uses the middlewares:
app.use(express.static(“public”));
app.use(methodOverride("_method"));
app.use(methodOverride(“Access-Control-Allow-Methods”));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
I am using uppy in a demo app and not in production.
Thank you for your help!