Closed vsnthdev closed 4 years ago
Thanks a lot for creating this very detailed issue, @vasanthdeveloper. We will take a look at this asap!
Thank you, I was actually in urgency as I had to open-source my project before the 8th of November as there's still a lot of work π
Here's a working copy of the request in Postman π https://www.getpostman.com/collections/e460f5997d62ec0733fb
I hope, I didn't expose my API keys π
This is working for me in postman
. But when tried to update it using this package, I am getting {statusCode: 431, data: ''}
, not 400.
Alright, this is very helpful. Thanks a lot. I'll be looking into this later today.
Thank you π if this works out, I'll be so happy π as I will open-source the project I've worked on for weeks now.
@vasanthdeveloper @pbteja1998 Fixed in version 1.1.1 :raised_hands: Thanks a lot for your help, guys!
There's still an issue with a pending promise. Reopening this issue to investigate.
This is now solved in 1.2.0. Also, I've changed to non-default export instead to resolve the problems with the require syntax.
Even though the cover image is updated the Promise
never resolves, thus blocking the execution flow when await
ed.
In the below code π the console.log()
never executes.
twitter.accountsAndUsers.accountUpdateProfileBanner({
banner: fs.readFileSync('coverPage.png', { encoding: 'base64' })
}).then(() => {
console.log('resolved!')
})
Describe the bug
As per the documentation of Twitter and
twitter-api-client
, here is the code I've written that should update an account's cover image πThis results in π
and does not update the cover image of the authorized user. A quick note: The import is wrapped in a
default
, which requires the usage of this βοΈ ugly syntax. Tried on JavaScript CommonJS and JavaScript ECMAScript Modules πTo reproduce
Steps to reproduce the behavior:
cover.jpg
Expected behavior
An updated cover image with a response of
statusCode
of 200 or 201 withdata
set to an empty string.Package Manager:
Yarn: v1.22.5 Node.js: v15.0.1
Additional context
According to the documentation, on Twitter, the field
banner
should be sent as a URL query parameter. But since a banner is usually a big file (relatively) it's a bad practice to send it through URL query parameters.Hence Twitter has updated to use
x-www-form-urlencoded
(POST body) and that isn't updated in their docs. Thanks, @Silind for making this module and I am π happy to give more info.