Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 43972b4

Browse files
committed
fix(cloudflare-workers): fix function not implemented error (#1390)
1 parent 71c8727 commit 43972b4

File tree

4 files changed

+7
-36
lines changed

4 files changed

+7
-36
lines changed

examples/cloudflare-workers/scripts/client.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,9 @@ const client = createClient<typeof registry>(
99
async function main() {
1010
console.log("🚀 Cloudflare Workers Client Demo");
1111

12-
// try {
13-
// // Create counter instance
14-
// const counter = client.counter.getOrCreate("demo");
15-
//
16-
// // Increment counter
17-
// console.log("Incrementing counter 'demo'...");
18-
// const result1 = await counter.increment(1);
19-
// console.log("New count:", result1);
20-
//
21-
// // Increment again with larger value
22-
// console.log("Incrementing counter 'demo' by 5...");
23-
// const result2 = await counter.increment(5);
24-
// console.log("New count:", result2);
25-
//
26-
// // Create another counter
27-
// const counter2 = client.counter.getOrCreate("another");
28-
// console.log("Incrementing counter 'another' by 10...");
29-
// const result3 = await counter2.increment(10);
30-
// console.log("New count:", result3);
31-
//
32-
// console.log("✅ Demo completed!");
33-
// } catch (error) {
34-
// console.error("❌ Error:", error);
35-
// process.exit(1);
36-
// }
3712
try {
3813
// Create counter instance
3914
const counter = client.counter.getOrCreate("demo");
40-
const conn = counter.connect();
41-
conn.on("foo", (x) => console.log("output", x));
4215

4316
// Increment counter
4417
console.log("Incrementing counter 'demo'...");

examples/cloudflare-workers/src/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const counter = actor({
55
actions: {
66
increment: (c, x: number) => {
77
c.state.count += x;
8-
c.broadcast("foo", 1);
8+
c.broadcast("newCount", c.state.count);
99
return c.state.count;
1010
},
1111
},

packages/cloudflare-workers/src/actor-handler-do.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ export function createActorDurableObject(
124124
runConfig,
125125
);
126126

127-
configureInspectorAccessToken(registry.config, managerDriver);
128-
129127
// Create inline client
130128
const inlineClient = createClientWithDriver(managerDriver, runConfig);
131129

@@ -192,9 +190,3 @@ export function createActorDurableObject(
192190
}
193191
};
194192
}
195-
function configureInspectorAccessToken(
196-
config: any,
197-
managerDriver: ManagerDriver,
198-
) {
199-
throw new Error("Function not implemented.");
200-
}

packages/cloudflare-workers/src/handler.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ export function createHandler<R extends Registry<any>>(
3333
registry: R,
3434
inputConfig?: InputConfig,
3535
): Handler {
36+
// HACK: Cloudflare does not support using `crypto.randomUUID()` before start, so we pass a default value
37+
//
38+
// Runner key is not used on Cloudflare
39+
inputConfig = { ...inputConfig, runnerKey: "" };
40+
41+
// Parse config
3642
const config = ConfigSchema.parse(inputConfig);
3743

3844
// Create config

0 commit comments

Comments
 (0)