I am trying to create a new folder in a shared drive through the Google Drive API. It keeps coming back with an error
Error: Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream at createError (C:\Users\SSC05\Desktop\project\PID\PID2\node_modules\axios\lib\core\createError.js:16) at dispatchHttpRequest (C:\Users\SSC05\Desktop\project\PID\PID2\node_modules\axios\lib\adapters\http.js:48) at new Promise () at Object.httpAdapter [as adapter] (C:\Users\SSC05\Desktop\project\PID\PID2\node_modules\axios\lib\adapters\http.js:20) at Gaxios. (C:\Users\SSC05\Desktop\project\PID\PID2\node_modules\gaxios\build\src\gaxios.js:65) at Generator.next () at C:\Users\SSC05\Desktop\project\PID\PID2\node_modules\gaxios\build\src\gaxios.js:19 at new Promise () at __awaiter (C:\Users\SSC05\Desktop\project\PID\PID2\node_modules\gaxios\build\src\gaxios.js:15) at Gaxios.request (C:\Users\SSC05\Desktop\project\PID\PID2\node_modules\gaxios\build\src\gaxios.js:60)
If I try to remedy that by doing fileMetaData.toString()
I end up with an untitled file NOT in the shared drive. I can upload files just fine, so I know it's not a problem with the authorization. I am using the code given in the documentation. It is as follows...
function createFolder(auth) {
const drive = google.drive({version: 'v3', auth});
var fileMetadata = {
'name': loadLog().name, //A function that pulls a name from a login file
'parents': [parentFileID],
'mimeType': 'application/vnd.google-apps.folder'
};
drive.files.create({
resource: fileMetadata,
fields: 'id'
}, function (err, file) {
if (err) {
// Handle error
console.error(err);
} else {
console.log('Folder Id: ', file.id);
}
});
}