Replies: 10 comments
-
Creating a |
Beta Was this translation helpful? Give feedback.
-
I will test it before I start my project. If I encounter any problems, I will report them or make a PR. |
Beta Was this translation helpful? Give feedback.
-
Tested with Cloudflare Workers (local dev mode) but the
It seems some packages or features are not supported by Cloudflare Worker. Is it possible to avoid using shim in Fedify for better capabilities? |
Beta Was this translation helpful? Give feedback.
-
We're willing to support edge functions including Cloudflare Workers in a long term, but I guess it wouldn't be trivial in a short term… 😭 One cloud edge function I've tested with Fedify is Deno Deploy at the moment. |
Beta Was this translation helpful? Give feedback.
-
Ah, Fedify on JSR would work better with edge functions. |
Beta Was this translation helpful? Give feedback.
-
Switching to
|
Beta Was this translation helpful? Give feedback.
-
Updated: Fixed, the typo caused the web finger not to return anything. I can run it correctly after adding polyfill. According to the tutorial - https://fedify.dev/tutorial/basics#actor-dispatcher I can call |
Beta Was this translation helpful? Give feedback.
-
Could you try a polyfill for Temporal API? |
Beta Was this translation helpful? Give feedback.
-
@elct9620, shouldn't Also, did you manage to get Fedify working with Cloudflare Workers? |
Beta Was this translation helpful? Give feedback.
-
I got Fedify working on Cloudflare Workers by
For the last one, I used this dirty solution: // package.json
{
"scripts": {
+ "prepare": "node ./patch-fedify-for-workers.js"
}
} // patch-fedify-for-workers.js
import { glob, readFile, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
const cwd = 'node_modules/@fedify/fedify';
const codeToDelete = ' with {\n type: "json"\n}';
for await (const entry of glob('*/*.js', { cwd })) {
(async () => {
const filePath = join(cwd, entry);
const originalContent = await readFile(filePath, 'utf8');
const patchedContent = originalContent.replace(codeToDelete, '');
if (originalContent !== patchedContent) {
await writeFile(filePath, patchedContent);
}
})();
} The This could be done better with esbuild, but I think this is good enough for myself as a temporary solution. I assume Workers will eventually support import attributes (and the Temporal API as well). |
Beta Was this translation helpful? Give feedback.
-
Hi,
I find the microblog document has some notes about
Recently, cloud edge functions like Cloudflare Workers have also gained popularity as JavaScript runtimes
Does Fedify expect to support it natively?
If I choose to use Cloudflare Workers, I need to use the Bindings feature to get the key-value store.
However, the
Federation
object is requiredkv
and initialized before handling the request.Or the expected usage is like this
Beta Was this translation helpful? Give feedback.
All reactions