drive.files.create throws the error: Invalid multipart request with 0 mime parts
See original GitHub issueWith "google-auth-library": "1.3.2"
and "googleapis": "27.0.0"
installed uploading to drive throws the Invalid multipart request with 0 mime parts
error. Here is the code:
const {OAuth2Client} = require('google-auth-library')
const {google} = require('googleapis')
const googleOAuth2Client = new OAuth2Client({clientId: GOOGLE_DRIVE_CLIENT_ID})
googleOAuth2Client.setCredentials(tokens)
const googleDrive = google.drive({
version: 'v3',
auth: googleOAuth2Client
})
googleDrive.files.create({
resource: {
name: 'test.png',
parents: [parentId]
},
media: {
mimeType: 'image/png',
body: fs.createReadStream('/Users/dmitry/Desktop/test.png')
}
}, function (err, response) {
if (err) {
console.error(err)
reject(err)
return
}
console.log(response.data)
})
As mentioned here and here, it works with "googleapis": "24.0.0"
, so it looks like the request -> axios change is the reason for this issue. Or am I missing something? There is no much information in the code sample on github (yeah, I realize that all the code samples from docs are currently not working).
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to fix Invalid multipart request with 0 mime parts error
This modified script supposes that your environment can upload files using Drive API. If the error related to API occurs, please confirm whether ......
Read more >Google Drive Upload API - Invalid multipart request with 0 ...
Google Drive SDK with Node.js googleapis package throws Error: Invalid multipart request with 0 mime parts on files.create · Upload file in node...
Read more >HTTP response code 400 with body: Invalid multipart request ...
After initial configuration, few files went through in a copy without ... code 400 with body: Invalid multipart request with 0 mime parts....
Read more >Upload file data | Google Drive
A multipart upload request lets you upload metadata and data in the same request. Use this option if the data you send is...
Read more >"Invalid multipart file in request" error for Gmail ...
2) Check the Content-Type if you are sending any attachment as multipart. Below might help you to understand some of the basics of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This issue was reintroduced after replacing axios with gaxios in v37.0.0 . Again, it only happens in Electron renderer process.
@DSnopov This is my 2nd day being wasted on trying to find a solution for this other than IPC. Any workaround?
UPDATE: Only workaround is to use a custom fork. More details in #2714.