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

The app.bsky.feed.getActorLikes endpoint does not appear to be working #2268

Closed
suibari opened this issue Mar 4, 2024 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@suibari
Copy link

suibari commented Mar 4, 2024

Describe the bug

I am using @atproto/api@0.10.4 from npm.
The getActorLikes() API returns "Profile not found" even if I specify the correct handle name or DID. (I am using my own authenticated handle and did.)

I implemented a function to hit the getActorLikes endpoint myself to try it out.
However, even though all URL parameters and options are correct, "400 bad request" is returned.

Note that requests from the following HTTP reference sites function properly and can retrieve likes.
https://docs.bsky.app/docs/api/app-bsky-feed-get-actor-likes

To Reproduce

Steps to reproduce the behavior:

  • Call getActorsLikes() from @atproto/api after authenticated. The specific actor is myself.
  • Hit app.bsky.feed.getActorLikes with bearer from somewhere other than the HTTP reference site. The specific actor is myself.

Expected behavior

The ability to retrieve "Likes" for the user specified in the "actor" parameter.

Details

  • Operating system: Ubuntu 22.04.4 (WSL2)
  • Node version: v21.6.1

Additional context

For reference, here is a function I implemented myself as an alternative to getActorLikes().

  async getActorLikesMyOwn(queryParams) {  // queryParams={actor: myhandle, limit: 100};
    const options = {
      method: 'GET',
      headers: {
        'Accept': 'application/json',
        'Authorization': `Bearer ${this.accessJwt}`,
      }
    };

    const url = new URL("https://bsky.social/xrpc/app.bsky.feed.getActorLikes");
    Object.keys(queryParams).forEach(key => url.searchParams.append(key, queryParams[key]));
    console.log(url.toString())
    
    try {
      const response = await fetch(url, options);
      if (!response.ok) {
        throw new Error('Network response was not ok');
      };
      const data = await response.json();
      return data;

    } catch(e) {
      console.error('There was a problem with your fetch operation:', e);
      throw e;
    };
  }
@suibari suibari added the bug Something isn't working label Mar 4, 2024
@mary-ext
Copy link
Contributor

mary-ext commented Mar 4, 2024

Any example code to reproduce the error?

@suibari
Copy link
Author

suibari commented Mar 4, 2024

Sorry, I solved the problem.
It was due to a mistake in my .env file.

The user specified as the actor in getActorLikes() and the bearer user were different, which caused the "Profile not found" and "Bad request" to appear.
By replacing it with the correct .env, getActorLikes() worked as expected.
However, it is strange that the HTML reference says "Does not require auth." but requires the user to be associated with authentication.

Issue close.

@suibari suibari closed this as completed Mar 4, 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

No branches or pull requests

2 participants