node.js - "Request Entity Too Large" Inserting new YouTube Reference -


i'm trying upload reference video youtube, i've created asset, whenever try inserting reference request entity large error, although file i'm uploading 3.4mb while api documentation states maximum file size 20gb.

any ideas doing wrong?

here's code sample:

fs.readfile(file_path, function(err, data) {     if (!err) {         ytpapi.references.insert({             auth: oauth2client,             onbehalfofcontentowner: contentowner,             resource: {                 assetid: asset_id,                 contenttype: 'video',                 media: {                     mimetype: 'video/mp4',                     body: data.body                 }             }         }, function (err, data) {              if (err) {                 console.log(err);             }              console.log('success');         });     } }); 

i found problem. mistakenly added media object under resource object.

here's correct code sample in case needs it:

fs.readfile(file_path, function(err, data) {     if (!err) {         ytpapi.references.insert({             auth: oauth2client,             onbehalfofcontentowner: contentowner,             resource: {                 assetid: asset_id,                 contenttype: 'video'             },             media: {                 mimetype: 'video/mp4',                 body: data.body             }         }, function (err, data) {              if (err) {                 console.log(err);             }              console.log('success');         });     } }); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -