gerwitz / sitewriter

Bringing IndieWeb to the JAM (Micropub for static sites)
http://sitewriter.net/
MIT License
22 stars 0 forks source link

Unable to upload media (from various apps) #76

Closed paulrobertlloyd closed 5 years ago

paulrobertlloyd commented 6 years ago

Support for media in micropub posts has broken down somewhere, though hard to diagnose how or why. Anyway, some error output for you…

Quill (using Micro.blog as my IndieAuth endpoint)

Trying to post with an image attached resulted in the following error:

HTTP/1.1 403 Forbidden
Server: Cowboy
Date: Mon, 03 Sep 2018 17:54:24 GMT
Connection: keep-alive
Content-Type: application/json
Referrer-Policy: no-referrer
Content-Security-Policy: script-src 'self' 'unsafe-inline'
X-Content-Type-Options: nosniff
Set-Cookie: rack.session=BAh7CEkiD3Nlc3Npb25faWQGOgZFVEkiRTdlOTNhMzUyODhmMzkwNGU5NjA4%0AMjlkMWVmZjIwYjdiMmUyYTYxOTYxMjVjYzcyOGYwMmU0MjZhNjFjZjgyN2UG%0AOwBGSSIJY3NyZgY7AEZJIjFTN2hHQUx6Vy9KcGU2OWthQlZFL1NRdkRQUjdu%0AMjk2QlVDS2dCanM3QmlVPQY7AEZJIg10cmFja2luZwY7AEZ7B0kiFEhUVFBf%0AVVNFUl9BR0VOVAY7AFRJIi1kYTM5YTNlZTVlNmI0YjBkMzI1NWJmZWY5NTYw%0AMTg5MGFmZDgwNzA5BjsARkkiGUhUVFBfQUNDRVBUX0xBTkdVQUdFBjsAVEki%0ALWRhMzlhM2VlNWU2YjRiMGQzMjU1YmZlZjk1NjAxODkwYWZkODA3MDkGOwBG%0A--a9dbd0c166844a2a194f9751452cb34457ecff39; path=/; HttpOnly
Set-Cookie: sitewriter.net=7e93a35288f3904e960829d1eff20b7b2e2a6196125cc728f02e426a61cf827e; path=/; HttpOnly
Content-Length: 116
Via: 1.1 vegur

{"error":"forbidden","error_description":"The authenticated user does not have permission to perform this request."}

Quill (using IndieAuth.com as my IndieAuth endpoint)

After changing my IndieAuth endpoint (worth a shot!) and logging out and clearing various cookies across all sites, I got a different error:

HTTP/1.1 100 Continue

HTTP/1.1 500 Internal Server Error
Server: Cowboy
Date: Mon, 03 Sep 2018 18:10:32 GMT
Connection: keep-alive
Content-Length: 77
Via: 1.1 vegur

An unhandled lowlevel error occurred. The application logs may have details.

Removing the attached image resulted in the post being successfully published.

Icro

Icro app didn't provide any error messaging in the app, but this line appeared in my status log:

Mustermann::ExpandError error

Sunlit

Trying to connect and save media here also caused issues.


This was all working fine previously, so not quite sure what’s changed or stopped working. Any ideas?

This bug is somewhat related to #75 in that it’s hard to debug exactly what’s going on when I can only go buy what clients are telling me (of which Quill is the most useful in that respect).

gerwitz commented 6 years ago

I hadn't added all of your requested variables for paths on media, so :minute was causing this. Deploying a correction now, with minimal testing. 🤠

paulrobertlloyd commented 6 years ago

Still need to test this, but sounds like a fix. I’d totally forgotten that I’d changed those values…!

paulrobertlloyd commented 6 years ago

Trying this again now, uploading media using Sunlit. Now I get a different error:

Octokit::UnprocessableEntity error:

PUT https://api.github.com/repos/paulrobertlloyd/paulrobertlloyd.com/contents/src/images/notes/2018-09-05-1831.jpg: 422 - Invalid request.

I should note that this file was successfully committed to my repo, so not sure why this error should be returned.

gerwitz commented 6 years ago

Is this still a problem? Best I can tell, this is a sporadic GitHub API issue ☹️

paulrobertlloyd commented 6 years ago

Not sure, will have to test again. However, looking at my activity log, there is now more information shown:

PUT https://api.github.com/repos/paulrobertlloyd/paulrobertlloyd.com/contents/src/images/notes/2018-10-10-0944.jpg: 422 - Invalid request.

"sha" wasn't supplied. // See: https://developer.github.com/v3/repos/contents/#update-a-file
paulrobertlloyd commented 5 years ago

Seems like I’m still having (different?) issues uploading media. The error log on SiteWriter reports back with undefined local variable or method `post' for #, and the Micro.blog apps report empty photo URL.

gerwitz commented 5 years ago

This does sound different. Sorry, I'll be on holiday until next week, so won't get to check on it :-(

paulrobertlloyd commented 5 years ago

Curious to know if you’ve had any thoughts on this one!?

gerwitz commented 5 years ago

I finally reproduced this! Hopefully that means a fix is imminent.

paulrobertlloyd commented 5 years ago

Woot! A Happy New Year indeed 😃

gerwitz commented 5 years ago

There are two distinct problems here.

The media endpoint for uploading files was broken. This is why Icro and Micro.blog were working, but then stopped. I think I've fixed this with a deployment underway now, but am having trouble with my test tooling so haven't verified.

Text posts with in-request attachments I just haven't implemented yet. This is why a photo post via Quill fails, for example. In debugging the above I made a lot of progress towards this and it might even be "working" except I have no UI for configuring your site to handle these!

I'm thinking through that … it might be as simple as using the "direct files" media endpoint configuration, but that seems wrong. I would want attachments to be stored to file paths that include parameters from the post itself. ¯\_(ツ)_/¯

paulrobertlloyd commented 5 years ago

Brill! Will have a go posting a photo this coming week, and let you know if I run into any further issues.

gerwitz commented 5 years ago

I've successfully tested every scenario with Micropub.rocks, so I'm closing this for now.