Open
Description
Repro:
- create fresh DO and workers project
npm create cloudflare-latest
Paste from example:
import { DurableObject } from "cloudflare:workers";
import { Browsable } from "@outerbase/browsable-durable-object";
@Browsable()
export class MyDurableObject extends DurableObject<Env> {
public sql: SqlStorage;
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
this.sql = ctx.storage.sql;
}
async fetch(request: Request): Promise<Response> {
return new Response("Hello from MyDurableObject");
}
}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext,
): Promise<Response> {
const path = new URL(request.url).pathname;
const id: DurableObjectId = env.MY_DURABLE_OBJECT.idFromName(path);
const stub = env.MY_DURABLE_OBJECT.get(id);
return stub.fetch(request);
},
} satisfies ExportedHandler<Env>;
- run
npm run start
and access localhost
Metadata
Metadata
Assignees
Labels
No labels