diff --git a/examples/cloudflare-workers/scripts/client.ts b/examples/cloudflare-workers/scripts/client.ts index 0143f7af3..5f9990e20 100644 --- a/examples/cloudflare-workers/scripts/client.ts +++ b/examples/cloudflare-workers/scripts/client.ts @@ -9,36 +9,9 @@ const client = createClient( 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'..."); diff --git a/examples/cloudflare-workers/src/registry.ts b/examples/cloudflare-workers/src/registry.ts index eb5c0be87..24277ebeb 100644 --- a/examples/cloudflare-workers/src/registry.ts +++ b/examples/cloudflare-workers/src/registry.ts @@ -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; }, }, diff --git a/examples/hono-bun/tsconfig.json b/examples/hono-bun/tsconfig.json index 0879c6aae..09aee214c 100644 --- a/examples/hono-bun/tsconfig.json +++ b/examples/hono-bun/tsconfig.json @@ -5,7 +5,7 @@ /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "target": "esnext", /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - "lib": ["esnext"], + "lib": ["esnext", "dom"], /* Specify what JSX code is generated. */ "jsx": "react-jsx", diff --git a/packages/cloudflare-workers/src/actor-handler-do.ts b/packages/cloudflare-workers/src/actor-handler-do.ts index 2e9ab756a..ccc673725 100644 --- a/packages/cloudflare-workers/src/actor-handler-do.ts +++ b/packages/cloudflare-workers/src/actor-handler-do.ts @@ -124,8 +124,6 @@ export function createActorDurableObject( runConfig, ); - configureInspectorAccessToken(registry.config, managerDriver); - // Create inline client const inlineClient = createClientWithDriver(managerDriver, runConfig); @@ -192,9 +190,3 @@ export function createActorDurableObject( } }; } -function configureInspectorAccessToken( - config: any, - managerDriver: ManagerDriver, -) { - throw new Error("Function not implemented."); -} diff --git a/packages/cloudflare-workers/src/handler.ts b/packages/cloudflare-workers/src/handler.ts index 71ae323f1..dfc5fbf70 100644 --- a/packages/cloudflare-workers/src/handler.ts +++ b/packages/cloudflare-workers/src/handler.ts @@ -33,6 +33,12 @@ export function createHandler>( 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