[Error: Media has to be a Buffer instance] - node.js

nodejs
image

#1

I want to upload a media twitter with image that is actaully a url (not a local file) - I get the above error (not a buffer instance)

what’s wrong with my snippet?

>     >    var MediaUpload = require('twitter-media');
>     var request = require('request');
> var remoteImage = "http://r.ddmcdn.com/s_f/o_1/cx_633/cy_0/cw_1725/ch_1725/w_720/APL/uploads/2014/11/too-cute-doggone-it-video-playlist.jpg"
>     request.get(remoteImage, function (error, response, body) {
>             if (!error && response.statusCode == 200) {
>                   var data = body;
>                   console.log("after read remote file");
>                  media_upload.uploadMedia("image", data, function(error , media_id_string, body) {
>                       console.log(error)
>                       console.log(media_id_string)
>                       console.log(body)
>                    })
>             }
>          });

#2

Hey @flamingLamb1 Can you please try hitting those endpoints with our twurl client? If you’re still seeing issues, please paste the entire request and response bodies, along with the expected vs actual output?

Thanks!