How to upload a MP4 file to Facebook using Node.JS


There are many online articles and API documents on Facebook graph API and uploading videos.  There seem to be 2 ways of uploading: non-resumable (e.g. providing a url for Facebook to download) or resumable (e.g. uploading the file in chunks).

The waiting for Facebook to download your url seems a bit unreliable. 

The uploading the file in chunks seems non-trivial.

So I am looking for a simple way to upload a small video file, less than 5MB.

One common error you may get is

    "error": {
        "message": "There was a problem uploading your video file. Please try again.",
        "type": "OAuthException",
        "code": 390,
        "error_subcode": 1363030,
        "is_transient": true,
        "error_user_title": "Video Upload Time Out",
        "error_user_msg": "Your video upload timed out before it could be completed. This is probably because of a slow network connection or because the video you're trying to upload is too large. Please try again.",
        "fbtrace_id": "GGx893kd"

The above is generic.  It has nothing to do with your authentication or the video file itself.  It simply means you are not making the right call to upload the file to Facebook.


  1. npm install fb
   1: var fs = require('fs') ;

   2: var readVideoStream = fs.createReadStream(localSrcVideo);


   4: var FB = require('fb');

   5: FB.setAccessToken(fbAccessToken);


   7: FB.api(

   8:   "/me/videos",

   9:   "POST",

  10:   {

  11:     "source": readVideoStream,

  12:     "description": videoDescription

  13:   }, function(response){

  14:     console.log(JSON.stringify(response, null, 4));

  15:   });




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s