Why does describeRepo fail with RepoNotFound once the agent has logged in? #3218
-
Once the agent has logged in, import { AtpAgent } from '@atproto/api';
const p = (obj:any) => {console.log(obj);}
const line = () => {console.log('\n'+'='.repeat(60));}
const identifier = process.env['BSKY_USERNAME']!;
const password = process.env['BSKY_PASSWORD']!;
const repoHandle = 'bsky.app';
p('confirm credentials:')
p({ identifier, password:!!password });
line();
async function tryDescribeRepo(handle:string){
type repoResponse = {success:boolean,data?:any,headers:any,status?: any,error?: any};
const repo:repoResponse = await agent.com.atproto.repo.describeRepo({ repo: handle }).catch(e=>e);
p({loggedInAs: agent.session?.handle ?? null,searchingForRepo:handle,success:!!repo.success,error:repo.error});
line();
}
let agent:AtpAgent;
p('new agent; succeeds');
agent = new AtpAgent({ service: 'https://bsky.social' });
await tryDescribeRepo(repoHandle);
p('agent logged in; fails');
await agent.login({ identifier, password });
await tryDescribeRepo(repoHandle);
p('still logged in, but own repo; succeeds');
await tryDescribeRepo(identifier);
p('agent logged out; still fails');
await agent.logout();
await tryDescribeRepo(repoHandle);
p('new agent; succeeds');
agent = new AtpAgent({ service: 'https://bsky.social' });
await tryDescribeRepo(repoHandle); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This might be related to an issue I raised on the Python SDK - describeRepo also confused me. It turns out you can only use it to describe repositories on the same PDS as the client, so you'd have to switch PDS first to use it. That's probably why it only worked on your client's own account, but it should work to describe the repo of any other account on the same PDS. In the Python SDK, you can still use describeRepo on any account by changing the base URL the client uses, and I assume there's a similar fix in the JS/TS API. I do think this is odd behaviour, though. |
Beta Was this translation helpful? Give feedback.
This might be related to an issue I raised on the Python SDK - describeRepo also confused me.
It turns out you can only use it to describe repositories on the same PDS as the client, so you'd have to switch PDS first to use it. That's probably why it only worked on your client's own account, but it should work to describe the repo of any other account on the same PDS.
In the Python SDK, you can still use describeRepo on any account by changing the base URL the client uses, and I assume there's a similar fix in the JS/TS API.
I do think this is odd behaviour, though.