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
-
Fedify v1's Object vocab class is broken in CJS exports — require("@fedify/fedify/vocab").Object is undefined because JavaScript's global Object shadows it in the CJS module.exports.
-
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).
-
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
Problem
When trying to broadcast an
Updateactivity to followers after changing the bot profile (avatar, header, bio, etc.), the activity cannot be constructed or sent.Root cause
Fedify v1's
Objectvocab class is broken in CJS exports —require("@fedify/fedify/vocab").Objectisundefinedbecause JavaScript's globalObjectshadows it in the CJS module.exports.Updateconstructor'sinstanceofcheck fails — Even when loading the correct v1 vocab viacreateRequire,new Update({ object: actor })throws"The object must be of type Object | URL"because theServicereturned byctx.getActor()fails theinstanceof Objectcheck (theObjectclass reference is broken).clone()+sendActivity()also fails — Constructing anUpdatewithoutobject, then usingclone({ objectIds: [actorUri] })works for the initial construction, butsendActivity()internally callsclone()andsignObject()which hit the same brokenObjectclass reference.What I tried
Context
@fedify/fedify@^1.8.15(resolves to 1.10.5)@fedify/fedify@2.1.1installed (via@fedify/redis)Updatefrom v2 either (v2'sUpdaterejects v1Serviceobjects)src/bot/index.tsExpected behavior
Calling
ctx.sendActivity()with anUpdateactivity 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
Objectclass in v1 could be fixed (e.g., by renaming it to avoid collision with the globalObject).Repo
https://github.com/rmdes/newsdiff