Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions examples/cloudflare-workers/scripts/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,9 @@ const client = createClient<typeof registry>(
async function main() {
console.log("🚀 Cloudflare Workers Client Demo");

// try {
// // Create counter instance
// const counter = client.counter.getOrCreate("demo");
//
// // Increment counter
// console.log("Incrementing counter 'demo'...");
// const result1 = await counter.increment(1);
// console.log("New count:", result1);
//
// // Increment again with larger value
// console.log("Incrementing counter 'demo' by 5...");
// const result2 = await counter.increment(5);
// console.log("New count:", result2);
//
// // Create another counter
// const counter2 = client.counter.getOrCreate("another");
// console.log("Incrementing counter 'another' by 10...");
// const result3 = await counter2.increment(10);
// console.log("New count:", result3);
//
// console.log("✅ Demo completed!");
// } catch (error) {
// console.error("❌ Error:", error);
// process.exit(1);
// }
try {
// Create counter instance
const counter = client.counter.getOrCreate("demo");
const conn = counter.connect();
conn.on("foo", (x) => console.log("output", x));

// Increment counter
console.log("Incrementing counter 'demo'...");
Expand Down
2 changes: 1 addition & 1 deletion examples/cloudflare-workers/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const counter = actor({
actions: {
increment: (c, x: number) => {
c.state.count += x;
c.broadcast("foo", 1);
c.broadcast("newCount", c.state.count);
return c.state.count;
},
},
Expand Down
8 changes: 0 additions & 8 deletions packages/cloudflare-workers/src/actor-handler-do.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ export function createActorDurableObject(
runConfig,
);

configureInspectorAccessToken(registry.config, managerDriver);

// Create inline client
const inlineClient = createClientWithDriver(managerDriver, runConfig);

Expand Down Expand Up @@ -192,9 +190,3 @@ export function createActorDurableObject(
}
};
}
function configureInspectorAccessToken(
config: any,
managerDriver: ManagerDriver,
) {
throw new Error("Function not implemented.");
}
6 changes: 6 additions & 0 deletions packages/cloudflare-workers/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export function createHandler<R extends Registry<any>>(
registry: R,
inputConfig?: InputConfig,
): Handler {
// HACK: Cloudflare does not support using `crypto.randomUUID()` before start, so we pass a default value
//
// Runner key is not used on Cloudflare
inputConfig = { ...inputConfig, runnerKey: "" };

// Parse config
const config = ConfigSchema.parse(inputConfig);

// Create config
Expand Down
Loading