Into the fediverse, part 1: a failed attempt

After migrating this blog to Astro, I wanted to publish posts out to ActivityPub using Fedify. Fedify recommends Deno as its primary runtime, and since the blog already deployed to Deno Deploy, using Deno KV for storage felt like a natural fit.

JSR packages inside Astro

Running the initial Fedify import threw a module resolution error:

[ERROR] Cannot find module '@fedify/fedify' imported from '<project>/src/lib/publish.ts'
Stack trace:
at fetchModule (<project>/node_modules/.deno/vite@6.3.5_1/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46813:19)
...

Vite, which powers Astro’s build pipeline, failed to resolve packages imported directly from JSR when sibling dependencies came through npm. I wanted the JSR build for its built-in Deno and Hono integrations (@fedify/fedify/x/hono and @fedify/fedify/x/deno).

I switched to the npm package of @fedify/fedify and used Redis for storage. The Deno KV adapter was also published to npm, though I had already configured Redis by the time I noticed.

Keypair generation, actor storage, and post publishing worked once wired against Redis.

Astro middleware incompatibility

Routing incoming federation requests required intercepting /.well-known/webfinger and passing it to Fedify. In Astro, request interception belongs in middleware. Loading Fedify inside Astro middleware immediately failed:

MiddlewareCantBeLoaded: An unknown error was thrown while loading your middleware.
at loadMiddleware (<project>/node_modules/.deno/astro@5.11.0_1/node_modules/astro/dist/core/middleware/loadMiddleware.js:8:24)
...

An open issue on the Fedify repository confirmed an incompatibility between Fedify and Astro’s middleware loading mechanism. That incompatibility stopped the integration.

Next steps

Fedify remains an active project with clear documentation. Hosting the ActivityPub service in its own process rather than embedding it directly in the static blog avoids the middleware conflict entirely. That separation is the plan for the next attempt.

Comments

Replies from the fediverse to @yuris@fedi.yuris.dev's post about this article.

No replies yet — open the post above from any Mastodon or fediverse app, reply to it, and your reply will appear here.