MarshalX / atproto

The AT Protocol (🦋 Bluesky) SDK for Python 🐍
https://atproto.blue
MIT License
321 stars 33 forks source link

`send_video` seems to sometimes silently result in "Video not found"? #418

Open Meorge opened 2 weeks ago

Meorge commented 2 weeks ago

I wish I had more useful information to share on this, but unfortunately I don't.

I've found that, very occasionally, when I use the send_video method, the resulting video will be missing on Bluesky - the post itself appears, but the video says "Video not found". Here is an example of this happening today. As you can see in the follow-up reply, by using the web client manually, I was able to upload the video just fine.

I was hoping that my logs might have caught an error or something useful, but they appear to be just fine - everything is returning 200 OK status codes:

2024-10-29 15:02:22,624 - HTTP Request: POST https://bsky.social/xrpc/com.atproto.server.createSession "HTTP/1.1 200 OK"
2024-10-29 15:02:22,903 - HTTP Request: GET https://amanita.us-east.host.bsky.network/xrpc/app.bsky.actor.getProfile?actor=turnabout-ca-dmv.meorge.com "HTTP/1.1 200 OK"
2024-10-29 15:02:23,009 - HTTP Request: GET https://amanita.us-east.host.bsky.network/xrpc/app.bsky.feed.getAuthorFeed?actor=ca-dmv-bot.bsky.social&filter=posts_with_media&limit=20 "HTTP/1.1 200 OK"
2024-10-29 15:02:28,043 - HTTP Request: POST https://amanita.us-east.host.bsky.network/xrpc/com.atproto.repo.uploadBlob "HTTP/1.1 200 OK"
2024-10-29 15:02:28,851 - HTTP Request: POST https://amanita.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord "HTTP/1.1 200 OK"
2024-10-29 15:02:28,949 - HTTP Request: POST https://amanita.us-east.host.bsky.network/xrpc/com.atproto.repo.createRecord "HTTP/1.1 200 OK"
2024-10-29 15:02:28,949 - Post for plate "LMAO EVO" is done!

Luckily, this issue only happens every once in a while, and it's not a big hassle to upload the video manually. Please let me know if you have ideas for ways I could test or diagnose it. I'll try to add to this thread if I gather more useful information as well.

MarshalX commented 2 weeks ago

Well, this is video processing problem on bsky side. Nothing to do from the client IMO. But what I can recommend. Migrate from send_video to proper video service. Pull processing state, etc. Why i suggest that: you can got the error code and error message why processing fails sometimes. Also, it is possible that video service just do not pick up processing. job from send_video method sometimes. This is also about server-side bug.

Here is how to work with video service: https://github.com/MarshalX/atproto/discussions/400#discussioncomment-10640507. You should implement create job and get job status by yourself. Pretty in the same manner

Let me know about your findings! And feel free to enrich my code snippet with full video flow uploading. We could add it as official SDK example

Meorge commented 2 weeks ago

Thanks for the confirmation! I agree that it probably makes sense to work on making the video API more proper than it is currently - that could eliminate bugs, as well as help us debug when things like this do happen.

I have a few other things going on right now, and the current function works the vast majority of the time, but I'll keep this in mind for something to work on soon when I have more time for it. 😄