Describe the bug
When trying to upload GIFs using the uploadMedia endpoint, I get an {"code":1,"name":"InvalidMedia"} error.
Uploading images works well with png/jpg however.
To Reproduce
Please indicate all steps that lead to this bug:
Request client setup (login method, OAuth2 scopes if applicable...)
import { TwitterApi } from 'twitter-api-v2';
const client = new TwitterApi({
appKey: XXXX,
appSecret: XXXX,
accessToken: XXXX,
accessSecret: XXXX,
});
Endpoint used or code example of what's happening wrong
Expected behavior
The gifs is uploaded, state success
Version
Node.js version : v18
Lib version : "twitter-api-v2": "^1.15.0"
OS (especially if you use Windows) : macOs 14.3.1
Additional context
After looking into the code, I realized that the media_category computed for gifs is TweetGif (in the getMediaCategoryByMime function), where in the API documentation, it is specified that the media_category should be tweet_gif
Describe the bug When trying to upload GIFs using the
uploadMedia
endpoint, I get an{"code":1,"name":"InvalidMedia"}
error. Uploading images works well with png/jpg however.To Reproduce Please indicate all steps that lead to this bug:
err.toJSON()
whenerr
is the caught error; take care of removing authentication HTTP headers)Expected behavior The gifs is uploaded, state success
Version
"twitter-api-v2": "^1.15.0"
Additional context
After looking into the code, I realized that the media_category computed for gifs is
TweetGif
(in the getMediaCategoryByMime function), where in the API documentation, it is specified that the media_category should betweet_gif