Fabian
Fabian
CDCloudflare Developers
Created by Fabian on 5/3/2024 in #workers-help
RPC Durable Object not working
Can somebody help me finding out why my RPC Durable Object is not working (locally, newest wrangler)? I basically have this (simplified) setup:
export class Example extends DurableObject {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
// ...
}

async fetch(request: Request): Promise<Response> {
// ...
}

async create(test: string) {
return test + "1";
}
}
export class Example extends DurableObject {
constructor(ctx: DurableObjectState, env: Env) {
super(ctx, env);
// ...
}

async fetch(request: Request): Promise<Response> {
// ...
}

async create(test: string) {
return test + "1";
}
}
When I try to call the create function now, it fails with TypeError: example.create is not a function. Again, simplified:
const objectId = c.env.EXAMPLE.idFromName("test");
const example = c.env.EXAMPLE.get(objectId);
const response = await example.create("example");
const objectId = c.env.EXAMPLE.idFromName("test");
const example = c.env.EXAMPLE.get(objectId);
const response = await example.create("example");
3 replies