DurableObjectStub is missing all methods

Hey,

I'm having a little issue. I'm trying my hand at Durable Objects for the first time and I've got some trouble getting them to work.

I have this code in my index.ts:
[...]
const episodeStorageStub = env.EPISODE_STORAGE.get(episodeStorageId);

console.log(episodeStorageStub, episodeStorageStub.countQuery)
[...]


And this in my durableObject.ts:
import { DurableObject } from "cloudflare:workers";

export class EpisodeStorage extends DurableObject {
    async countQuery(): Promise<Number> {
        const answers = (await this.ctx.storage.get<Answer[]>("answers", {allowConcurrency: true}))||[];

        return answers.length;
    }
}


Yet somehow my countQuery keeps being returned as undefined. Am I overlooking something?
I'm basically following this: https://developers.cloudflare.com/durable-objects/examples/build-a-counter/
Cloudflare Docs
This example shows how to build a counter using Durable Objects and Workers with RPC methods that can print, increment, and decrement a name provided
Was this page helpful?