voxpelli / webpage-micropub-to-github

Self-hosteable Micropub endpoint that publishes to Jekyll by committing to GitHub

Repository from Github https://github.comvoxpelli/webpage-micropub-to-githubRepository from Github https://github.comvoxpelli/webpage-micropub-to-github

Errors uploading media to github

keithjgrant opened this issue · comments

This is strange, because media uploads have worked for me, even in the past few days. But today, I’ve had multiple errors when I try to post with a photo attached. The post content is committed to GitHub, but the media file is not.

Error log on Heroku looks as follows:

2018-09-14T13:00:28.887685+00:00 app[web.1]: GitHub Error { message: 'Invalid request.\n\n"sha" wasn\'t supplied.',
2018-09-14T13:00:28.887691+00:00 app[web.1]:   documentation_url: 'https://developer.github.com/v3/repos/contents/#update-a-file' }
2018-09-14T13:00:28.887795+00:00 app[web.1]: Failed to upload media

It might be relevant that this started happening after I tried uploading a large image and got an out of memory error on Heroku. Is it possible the git repository on Heroku is out of sync? I don’t really know how to check that, though I’ve tried re-starting my dynos and even re-deploying the app.

Oh, I figured it out: I wasn’t using the :slug in the media filename and I was uploading the same file repeatedly for testing. This resulted in an existing file path/name, so I think it was trying to overwrite an existing file instead of creating a new one.

I added :slug into my MICROPUB_MEDIA_FILES_STYLE variable and it fixed the issue.