Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.bsky.feed.getPosts fails with more than a certain number of arguments uris #160

Closed
sugyan opened this issue Apr 21, 2024 · 0 comments · Fixed by #161
Closed

app.bsky.feed.getPosts fails with more than a certain number of arguments uris #160

sugyan opened this issue Apr 21, 2024 · 0 comments · Fixed by #161
Labels
bug Something isn't working

Comments

@sugyan
Copy link
Owner

sugyan commented Apr 21, 2024

Versions

  • atrium-api: 0.21.0
  • atrium-xrpc: 0.10.4
  • atrium-xrpc-client: 0.5.2

How to reproduce

use atrium_api::client::AtpServiceClient;
use atrium_api::types::string::AtIdentifier;
use atrium_xrpc_client::reqwest::ReqwestClient;
use itertools::Itertools;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = AtpServiceClient::new(ReqwestClient::new("https://api.bsky.app"));
    let uris = client
        .service
        .app
        .bsky
        .feed
        .get_author_feed(atrium_api::app::bsky::feed::get_author_feed::Parameters {
            actor: AtIdentifier::Handle("atproto.com".parse()?),
            cursor: None,
            filter: None,
            limit: 30.try_into().ok(),
        })
        .await?
        .feed
        .iter()
        .map(|post| post.post.uri.clone())
        .unique()
        .collect_vec();
    client
        .service
        .app
        .bsky
        .feed
        .get_posts(atrium_api::app::bsky::feed::get_posts::Parameters {
            uris: uris.into_iter().take(22).collect(),
        })
        .await?;
    Ok(())
}

Output:

Error: XrpcResponse(XrpcError { status: 400, error: Some(Undefined(ErrorResponseBody { error: Some("InvalidRequest"), message: Some("Error: uris/0 must be a valid at-uri") })) })

If .take(22) is less than 21, no error occurs.

@sugyan sugyan added the bug Something isn't working label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant