I'm using twitter-lite library and I want to update a Twi profile picture.
At the moment I'm trying this :
var fs = require('fs');
var Twit = require('twitter-lite');
var T = new Twit({
consumer_key: '',
consumer_secret: '',
access_token: '',
access_token_secret: ''
});
var image64str = fs.readFileSync('kitten.jpg', {encoding: 'base64'});
T.post('account/update_profile_image', { image: image64str }, function(err) {
if(err) {console.error(err); return;}
console.log('done');
});
But I get the following error :
/Users/huyvunguyen/node_modules/node-fetch/lib/index.js:272
return Body.Promise.reject(new FetchError(invalid json response body at ${_this2.url} reason: ${err.message}
, 'invalid-json'));
^
FetchError: invalid json response body at https://api.twitter.com/1.1/account/update_profile_image.json reason: Unexpected end of JSON input
at /Users/huyvunguyen/node_modules/node-fetch/lib/index.js:272:32
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
type: 'invalid-json'
}
Anyone know how can I debug this ?