ifvictr / ghost-storage-github

:octocat: GitHub storage adapter for Ghost
https://npm.im/ghost-storage-github
MIT License
65 stars 12 forks source link

"Invalid request. 'sha' wasn't supplied" error on image upload #18

Closed oscarmorrison closed 4 years ago

oscarmorrison commented 5 years ago
image
NAME: InternalServerError
CODE: 422
MESSAGE: {"message":"Invalid request.\n\n\"sha\" wasn't supplied.","documentation_url":"https://developer.github.com/v3/repos/contents/#update-a-file"}
ifvictr commented 5 years ago

Hi @oscarmorrison!

Thanks for reporting this. Could you let me know which version of ghost-github you were using, and the action you were performing (uploading or replacing an image)?

oscarmorrison commented 5 years ago

Thanks for the quick response @ifvictr

on the latest version of ghost-github 1.0.2

image

And on ghost v2.22.1 (upgraded yesterday)

That error is when I am just trying to upload a new image into a post. The images actually do upload: https://github.com/oscarmorrison/blog.oscarmorrison.com-assets/tree/master/2019/05 but somehow not correctly telling ghost about the image

ifvictr commented 5 years ago

Did the error also occur before you upgraded to v2.22.1? If not, what was the version you upgraded from?

On Mon, May 20, 2019 at 5:13 PM Oscar Morrison notifications@github.com wrote:

Thanks for the quick response @ifvictr https://github.com/ifvictr

on the latest version of ghost-github 1.0.2

[image: image] https://user-images.githubusercontent.com/1651212/58059584-eea8a100-7bb0-11e9-9a5a-05b7ecdf359b.png

And on ghost v2.22.1 (upgraded yesterday)

That error is when I am just trying to upload a new image into a post. The images actually do upload: https://github.com/oscarmorrison/blog.oscarmorrison.com-assets/tree/master/2019/05 but somehow not correctly telling ghost about the image

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ifvictr/ghost-github/issues/18?email_source=notifications&email_token=ACNEKJIINQXN2HZW5HWHUOLPWM5D3A5CNFSM4HN7N5O2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV2MVFQ#issuecomment-494193302, or mute the thread https://github.com/notifications/unsubscribe-auth/ACNEKJO6TPMNKSN2I4BGLY3PWM5D3ANCNFSM4HN7N5OQ .

oscarmorrison commented 5 years ago

Hmm. I am not 100% sure. I hadn't added a post for a while, I upgraded without checking. I was on v2.0 before.

ifvictr commented 5 years ago

@oscarmorrison I just tested ghost-github@1.0.2 on ghost@2.22.3 locally, and couldn't reproduce the error you were getting. I think probably didn't configure it correctly—could I see how your config looks like?

oscarmorrison commented 5 years ago

/var/www/ghost# cat config.production.json

Screen Shot 2019-05-26 at 11 52 32 am
ifvictr commented 5 years ago

I just tested a bit more and was finally able to reproduce your error, while also uncovering a few others! I'll start looking into how to fix all of them and will try to ship an update by the end of next week. Stay tuned!

oscarmorrison commented 5 years ago

Thanks @ifvictr

oscarmorrison commented 5 years ago

@ifvictr any update? Thanks

ifvictr commented 5 years ago

@oscarmorrison Sorry, haven't had time to delve deeper into this issue. I'll post an update when I find the issue :)

ifvictr commented 4 years ago

@oscarmorrison Looks like this was happening because the adapter was trying to update an existing file with the contents of the uploaded file, which was caused by GitHubStorage#exists. I'm about to release 2.0.0, it should be fixed there!

ifvictr commented 4 years ago

Update: It's here! Enjoy: https://github.com/ifvictr/ghost-storage-github/releases/tag/v2.0.1