bluesky-social / atproto

Social networking technology created by Bluesky
Other
6.88k stars 486 forks source link

Problem retrieving image URL from a mention #3051

Open scottjlaw opened 2 days ago

scottjlaw commented 2 days ago

Describe the bug

Trying to retrieve the URL and/or download an image embedded in a mention via a bot in node.js.

To Reproduce

Steps to reproduce the behavior:

  1. A mention that contains an image:
const did = mention.author.did;
const cid = mention.record.embed.images[0].image.ref;

const blob = await agent.api.com.atproto.sync.getBlob({ cid, did });

It then throws an error stating "Could not find repo for DID:"

Expected behavior

When I look in the browser, the URL of the image is in the format as follows, with the did and cid value extracted above in the following URL:

https://cdn.bsky.app/img/feed_fullsize/plain/[DID]/[CID]@jpeg

When creating an agent I am using this. Is there some place you have to specify the CDN?

const agent = new AtpAgent({ service: 'https://bsky.social' });