bluesky-social / feed-generator

ATProto Feed Generator Starter Kit
MIT License
919 stars 329 forks source link

Unsupported algorithm error #57

Closed stevenjwheeler closed 1 year ago

stevenjwheeler commented 1 year ago

I have created a feed using the documentation, and got all the way to publishing it onto Bluesky, but in Bluesky, it says Unsupported Algorithm. Im successfully getting a feed over at https://vrfurry-bsky.oasislab.co.uk/xrpc/app.bsky.feed.getFeedSkeleton?feed=at://did:plc:mkklr4smns2baynajhq3in6g/app.bsky.feed.generator/sfw-feed on both HTTPS and HTTP using a Nginx reverse proxy.

I have barely made any changes to the algorithm. I'm using the base whats-alf.ts (renamed to sfw-feed.ts, and shortname changed to 'sfw-feed'), and I modified the subscription.ts to filter for a different word (a hashtag).

What could be causing this Unsupported Algorithm error? Thanks!

dholms commented 1 year ago

Sounds like you may be calling app.bsky.feed.getTimeline (which is a special-case route for only reverse-chronological). You'll want to use app.bsky.feed.getFeed

stevenjwheeler commented 1 year ago

Sounds like you may be calling app.bsky.feed.getTimeline (which is a special-case route for only reverse-chronological). You'll want to use app.bsky.feed.getFeed

Im not calling app.bsky.feed.getTimeline. I've not modified any logic except the whats-alf.ts and subscription.ts, and searching through my files, the only references to app.bsky.feed.getTimeline is in src\lexicon\index.ts, and src\lexicon\lexicons.ts. Also, the only thing I see close to app.bsky.feed.getFeed thats not in the lexicon files, is server.app.bsky.feed.getFeedSkeleton in src\methods\feed-generation.ts.

dholms commented 1 year ago

It's hard to say without seeing your code, but it may be worth adding some logs in https://github.com/bluesky-social/feed-generator/blob/main/src/methods/feed-generation.ts to see why it is throwing that error

stevenjwheeler commented 1 year ago

It's hard to say without seeing your code, but it may be worth adding some logs in https://github.com/bluesky-social/feed-generator/blob/main/src/methods/feed-generation.ts to see why it is throwing that error

Okay, I put a console log before if ( feedUri.hostname !== ctx.cfg.publisherDid || feedUri.collection !== 'app.bsky.feed.generator' || !algo ) { throw new InvalidRequestError( 'Unsupported algorithm', 'UnsupportedAlgorithm', ) } which printed out the feedUri.hostname, ctx.cfg.publisherDid, feedUri.collection and they match. But when I did console.log(algo) and refreshed the feed on bsky, it returns undefined.

stevenjwheeler commented 1 year ago

Okay, i figured it out. the shortname of the algo needs to match the recordName of the publishFeedGen. That explains why i could see the feed manually but not via the bluesky app. Thanks for your help!

dholms commented 1 year ago

sweet glad you got it working 🙌