sugyan / atrium

Rust libraries for Bluesky's AT Protocol services.
MIT License
242 stars 26 forks source link

Video upload XRPCNotSupported 404 error #261

Open klausi opened 2 days ago

klausi commented 2 days ago

Hi,

I'm trying to upload a video from my Mastodon sync tool:

let output = bsky_agent
                .api
                .app
                .bsky
                .video
                .upload_video(bytes.to_vec())
                .await
                .context(format!(
                    "Failed uploading video to Bluesky {}",
                    attachment.attachment_url
                ))?;

This returns an error:

Error posting to Bluesky: Error {
    context: "Failed uploading video to Bluesky https://files.mastodon.social/cache/media_attachments/files/113/561/819/830/868/286/original/e05a90a96ab2e71f.mp4",
    source: XrpcResponse(
        XrpcError {
            status: 404,
            error: Some(
                Undefined(
                    ErrorResponseBody {
                        error: Some(
                            "XRPCNotSupported",
                        ),
                        message: Some(
                            "XRPCNotSupported",
                        ),
                    },
                ),
            ),
        },
    ),
}

Full code is in https://github.com/klausi/mastodon-bluesky-sync/blob/bsky-video/src/post.rs#L276

Do you know what the problem might be? Thanks!

sugyan commented 2 days ago

Uploading video is not well documented yet (https://github.com/bluesky-social/bsky-docs/pull/227) and confusing, but app.bsky.video.uploadVideo is not available from BskyAgent. This is a duplicate of #259 and examples/video has now been added, so please refer there.

klausi commented 17 hours ago

Thanks for the quick help, as always! Added you to acknowledgements https://github.com/klausi/mastodon-bluesky-sync/blob/main/README.md#acknowledgements

The example makes sense, but is quite long. Should we build an API abstraction into Atrium? Ideally I want to pass the Bluesky Agent and some bytes to a function and it should do everything for me until the video is uploaded.

Also should the bsky_agent.api.app.bsky.video.upload_video() function be removed? It is confusing that it exists in the SDK when it does not work?