I tried uploading a video to Twitter via Chunked Uploading using the Twit npm librarym https://www.npmjs.com/package/twit and all I keep getting back is this error:
allErrors: [ { code: 324, message: 'Pre-processing has not been done for this video' } ]
Here is my code:
let T = new Twit({
consumer_key: oAuthConsumerKey,
consumer_secret: oAuthConsumerSecret,
access_token: access_token,
access_token_secret: access_token_secret,
timeout_ms: 60 * 1000,
strictSSL: true,
});
let filePath =...;
T.postMediaChunked({ file_path: filePath }, function (err, data, response) {
fs.unlink(filePath, () => { }); //Delete File
if (data) {
let mediaIdString = data['media_id_string'];
let { error } = await T.post('media/metadata/create', metaPrams);
if (error) {
throw error;
}
//If we got here, then no errors.Cool
let mediaIds = [];
mediaIds.push(mediaIds);
//And then I post the status here
let params = { status: bodyText };
params['media_ids'] = mediaIds;
let { error, data } = await T.post('statuses/update', params);
//The error I keep getting back is this
allErrors: [
{
code: 324,
message: 'Pre-processing has not been done for this video'
}
]
}
if (err) {
throw err;
}
});
Please, what can I do to resolve this? Thank you.