Skip to content

Cannot send Update activity to broadcast profile changes (Fedify v1/v2 + CJS Object export issue) #18

@rmdes

Description

@rmdes

Problem

When trying to broadcast an Update activity to followers after changing the bot profile (avatar, header, bio, etc.), the activity cannot be constructed or sent.

Root cause

  1. Fedify v1's Object vocab class is broken in CJS exportsrequire("@fedify/fedify/vocab").Object is undefined because JavaScript's global Object shadows it in the CJS module.exports.

  2. Update constructor's instanceof check fails — Even when loading the correct v1 vocab via createRequire, new Update({ object: actor }) throws "The object must be of type Object | URL" because the Service returned by ctx.getActor() fails the instanceof Object check (the Object class reference is broken).

  3. clone() + sendActivity() also fails — Constructing an Update without object, then using clone({ objectIds: [actorUri] }) works for the initial construction, but sendActivity() internally calls clone() and signObject() which hit the same broken Object class reference.

What I tried

// Attempt 1: Direct construction — fails with "The object must be of type Object | URL"
const actor = await ctx.getActor(username);
const update = new Update({ actor: actorUri, object: actor });

// Attempt 2: Clone with objectIds — fails inside sendActivity's signObject
const update = new Update({ actor: actorUri });
const withObject = update.clone({ objectIds: [actorUri] });
await ctx.sendActivity({ identifier: username }, "followers", withObject);

Context

  • Botkit 0.3.1 depends on @fedify/fedify@^1.8.15 (resolves to 1.10.5)
  • My project also has @fedify/fedify@2.1.1 installed (via @fedify/redis)
  • The dual-package situation means I can't import Update from v2 either (v2's Update rejects v1 Service objects)
  • The code runs inside a SvelteKit server (Vite-bundled), with the bot code imported from src/bot/index.ts

Expected behavior

Calling ctx.sendActivity() with an Update activity containing the bot's actor should work, allowing profile changes to be broadcast to followers (as Mastodon and other implementations do).

Workaround

Profile changes propagate naturally when remote instances re-fetch the actor on the next post. But this means changes like avatar/header updates aren't visible to followers until a new diff is posted.

Possible fix

Upgrading Botkit to Fedify v2 would resolve the version mismatch. Alternatively, the CJS export of the Object class in v1 could be fixed (e.g., by renaming it to avoid collision with the global Object).

Repo

https://github.com/rmdes/newsdiff

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions